Policy: require minimal push in bare multisig output scripts #35225

pull pinheadmz wants to merge 2 commits into bitcoin:master from pinheadmz:p2ms-nonstandard-nonminimal changing 3 files +56 −13
  1. pinheadmz commented at 7:45 PM on May 6, 2026: member

    Closes #23285 by adding CheckMinimalPush() in MatchMultisig() in solver.cpp which is only used for policy checks (not consensus).

    First commit asserts current behavior on master with unit and functional tests, second commit tightens the policy.

    I noticed CheckMinimalPush() has an assert(0 <= opcode && opcode <= OP_PUSHDATA4). That continues to be protected by GetScriptOp() which has guard if (opcode <= OP_PUSHDATA4)

    To address concern about current usage I claude-generated this script which efficiently scanned all blk*.dat files from a fully-synced node and reported all occurrences of this oddity (report below).

    Block Date vout Type Ops Transaction
    244029 2013-06-30 0 1-of-3 OP_PUSHDATA1 ×2 c49b3c445c89d832289de0fd3b0281efdcce418333dacd028061e8de9f0a6f10
    244029 2013-06-30 0 1-of-3 OP_PUSHDATA1 ×3 72590fcf0d8021bad77826c5008eaca3541f81d212d55bb7c02ec6a4bf584404
    244042 2013-06-30 0 1-of-3 OP_PUSHDATA1 ×2 2d201879608ed2d14c362dff713a6d17d680cb42d5175dfe42e960e94736be04
    262733 2013-10-10 3 1-of-2 OP_PUSHDATA1 ×1 055cd2d8ff819ccd7182a08818bf85f79f22e089b81c4f6325014436e172d9b9
    263066 2013-10-12 3 1-of-2 OP_PUSHDATA1 ×1 d8773a20a841b4105a98fb2f448f3d9bae2be06f0b9221c02a7cb4d2077f67b9
    263069 2013-10-12 2 1-of-2 OP_PUSHDATA1 ×1 5b2169a66a937571767f278097aab307ba95a5dd5beaf9e98a64802218511a52
    263096 2013-10-12 2 1-of-2 OP_PUSHDATA1 ×1 c6f2bf13c8742fe5136dba82ce76d1513732d5a5b2d24c8d1bc1a4b92b15cff4
    263101 2013-10-12 2 1-of-2 OP_PUSHDATA1 ×1 40af216d3207ba85a47a913a06ace72a10d433ebeb1e12a5c36713a2b11964aa
    263421 2013-10-13 2 1-of-3 OP_PUSHDATA1 ×3 11378d2a2bb5514dc7bd5d3bf2eb94dd197e235e9337cac404cf79aa3119e53c
    263421 2013-10-13 3 1-of-3 OP_PUSHDATA1 ×3 11378d2a2bb5514dc7bd5d3bf2eb94dd197e235e9337cac404cf79aa3119e53c
    263421 2013-10-13 4 1-of-1 OP_PUSHDATA1 ×1 11378d2a2bb5514dc7bd5d3bf2eb94dd197e235e9337cac404cf79aa3119e53c
    264469 2013-10-18 1 1-of-3 OP_PUSHDATA1 ×3 92a9a88b078d69de943d9d5d1d3e6b51652952200578e655e50cafaf45a17c34
    264469 2013-10-18 2 1-of-3 OP_PUSHDATA1 ×2 92a9a88b078d69de943d9d5d1d3e6b51652952200578e655e50cafaf45a17c34
    264469 2013-10-18 1 1-of-3 OP_PUSHDATA1 ×3 7c0eec816b67145a67cbfd479e3c3474df814e31c2e6ff752a48a5a6754c6c2c
    264469 2013-10-18 2 1-of-3 OP_PUSHDATA1 ×2 7c0eec816b67145a67cbfd479e3c3474df814e31c2e6ff752a48a5a6754c6c2c
    268068 2013-11-05 0 1-of-2 OP_PUSHDATA1 ×1 8e2c7cec5006949e1929f70961da8f85eebfe06a4979d611ec93ab384eaa34ed
    268068 2013-11-05 0 1-of-2 OP_PUSHDATA1 ×1 5e29ff050333e2d01a1995cee2ec81f7549baeaef56aa38cb912184794837e84
    337908 2015-01-07 2 1-of-1 OP_PUSHDATA1 ×1 04ab6edee514a0ee2aeff48ca672d6f47d6c40923abb0d78aa33ec7e2001eb09
  2. test: assert current policy allows bare multisig with nonminimal push 25b4841588
  3. POLICY: require bare multisig outputs use minimal push for pubkeys 36462c7a31
  4. DrahtBot added the label TX fees and policy on May 6, 2026
  5. DrahtBot commented at 7:45 PM on May 6, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35225.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


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-07 12:12 UTC

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