Misleading name for IsDERSignature function #5284

issue oleganza opened this issue on November 15, 2014
  1. oleganza commented at 9:34 AM on November 15, 2014: none

    This function takes in not a DER signature, but a DER signature appended with hashtype byte.

    I suggest calling plain DER signature a "signature" and a signature with hashtype - "script signature".

    So the functions could be renamed like so:

    IsDERSignature -> IsValidScriptSignature IsLowDERSignature -> IsLowScriptSignature IsDefinedHashtypeSignature -> IsValidHashtypeInScriptSignature

    In fact, I don't see a good reason to allow invalid hashtypes at all. Validity of hashtype should probably go right in general verification code (in IsDERSignature).

    Thoughts?

  2. sipa commented at 10:56 AM on November 15, 2014: member

    I understand the confusion. The name of the function means "is this a (script) signature with valid DER?".

    Also, there is no such thing as an invalid hashtype. All 256 values for the hashtype byte are valid. There are just only 6 intended ones.

    The reason for splitting DER off from hashtype checks is because DER violations pose a malleability problem (which BIP62 plans to make illegal in a softfork), while the unknown hashtypes are at most a minor implementation complication, and only made nonstandard for now.

  3. laanwj added the label Brainstorming on Dec 5, 2014
  4. paveljanik commented at 12:07 PM on October 4, 2015: contributor

    As we do not longer have such function (it was renamed to IsValidSignatureEncoding thus solving this issue), can we close this?

  5. laanwj closed this on Feb 16, 2016

  6. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-01 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me