test: cover Taproot standardness rules in mempool_accept #35882

pull jeanpablojp wants to merge 1 commits into bitcoin:master from jeanpablojp:test-taproot-standardness changing 1 files +24 −0
  1. jeanpablojp commented at 2:06 PM on August 4, 2026: contributor

    IsWitnessStandard has three policy rules for Taproot spends: annexes are nonstandard, tapscript stack items are limited to 80 bytes, and an empty control block is rejected. None of them is covered by a test that ties the bad-witness-nonstandard reject reason to a Taproot cause.

    All nine existing assertions of that reject reason are for other output types: seven in p2p_segwit.py for P2WSH and P2SH-P2WSH, one in mempool_accept.py for P2A, and one in txpackage_tests.cpp. feature_taproot.py does exercise annexes and oversized stack items, but it checks standardness with assert_raises_rpc_error(-26, None, ...), so it never asserts which rule rejected the spend. MAX_STANDARD_TAPSCRIPT_STACK_ITEM_SIZE has three references in the whole repository, none of them in tests.

    This adds three cases to mempool_accept.py. The reference transaction the file already builds spends a P2TR output through the script path, so each case only has to mutate its witness stack: append an annex, insert an 81-byte stack item, or empty the control block.

    To make sure each case hits the rule it claims to cover, I disabled the three branches in src/policy/policy.cpp one at a time and reran the test. Each case fails with its branch disabled and passes with it back in place.

    Tested with:

    build/test/functional/mempool_accept.py
    
  2. test: cover Taproot standardness rules in mempool_accept 734f5c7442
  3. DrahtBot added the label Tests on Aug 4, 2026
  4. DrahtBot commented at 2:07 PM on August 4, 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/35882.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

Labels

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-08-11 09:51 UTC

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