[Refactor] Add MAX_STANDARD_SCRIPTSIG_SIZE to policy #20497

pull sanket1729 wants to merge 1 commits into bitcoin:master from sanket1729:policy changing 2 files +11 −8
  1. sanket1729 commented at 8:06 PM on November 25, 2020: contributor

    Bitcoin core has a standardness rule for max satisfaction script sig size. This PR adds to the policy header file so that it is documented along with along policy rules. The initial reasoning that 1650 is an implicit limit(would not reach assuming all other policy rules are being followed) is outdated.

    As we now know, bitcoin transactions can have spend conditions are more than just signatures and there may exist p2sh transactions involving 100 byte preimages that maybe non-standard because of this rule. Because this rule is no longer implicit, we should explicitly document it in policy header file

  2. Add MAX_STANDARD_SCRIPTSIG_SIZE to policy
    Bitcoin core has a standardness rule for max satisfaction script sig size.
    This PR adds to the policy header file so that it is documented along with
    along policy rules. The initial reasoning that 1650 is an implicit
    limit(would not reached assuming all other policy rules are being
    followed) is outdated.
    
    As we now know, bitcoin transactions can have spend conditions are more than
    just signatures and there may exist p2sh transactions involving 100 byte
    preimages that maybe non-standard because of this rule. Because this
    rule is no longer implicit, we should explicitly document it in policy
    header file
    e416cfc92b
  3. sipa commented at 8:45 PM on November 25, 2020: member

    utACK e416cfc92bf51f6fd088ab61c2306c5e73877dd0

  4. practicalswift commented at 9:12 PM on November 25, 2020: contributor

    cr ACK e416cfc92bf51f6fd088ab61c2306c5e73877dd0 @sipa eems ou issed he irst haracter n he ommit ash? Edit: Now fixed! Good!

  5. DrahtBot added the label TX fees and policy on Nov 25, 2020
  6. theStack approved
  7. theStack commented at 11:16 PM on November 26, 2020: member

    Code Review ACK e416cfc92bf51f6fd088ab61c2306c5e73877dd0

  8. in src/policy/policy.h:48 in e416cfc92b
      43 | @@ -44,6 +44,8 @@ static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80;
      44 |  static const unsigned int MAX_STANDARD_TAPSCRIPT_STACK_ITEM_SIZE = 80;
      45 |  /** The maximum size of a standard witnessScript */
      46 |  static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600;
      47 | +/** The maximum size of a standard ScriptSig */
      48 | +static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE = 1650;
    


    emilengler commented at 5:57 AM on November 27, 2020:

    nit: Why use full 4 bytes for this? An (unsigned short) could handle that number as well by only taking half the space.


    sipa commented at 6:05 AM on November 27, 2020:

    It's a static constant. With some luck it gets inlined, and isn't even materialized in the binary. Even if it is, I doubt anyone cares about saving 2 bytes.

  9. emilengler commented at 5:57 AM on November 27, 2020: contributor

    Concept ACK

  10. MarcoFalke merged this on Nov 27, 2020
  11. MarcoFalke closed this on Nov 27, 2020

  12. sidhujag referenced this in commit 43ab975019 on Nov 27, 2020
  13. MarcoFalke locked this on Feb 15, 2022

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-04-17 09:14 UTC

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