test: Add more invalid txoutproof variants #35817

pull dagimabebe wants to merge 5 commits into bitcoin:master from dagimabebe:test-txoutproof-invalid-variants changing 3 files +204 −115
  1. dagimabebe commented at 8:54 PM on July 26, 2026: none

    Replaces the TODO at rpc_txoutproof.py:109 with additional invalid proof test cases.

    The existing test already checks a single-transaction block spoofing attack. This adds five more mutation variants to exercise different failure paths in CPartialMerkleTree::ExtractMatches:

    • Wrong header hash: set hashPrevBlock to zero so the block lookup fails
    • Inflated nTransactions: set to 999999 so it mismatches the real block's nTx
    • Tampered hash: replace the first hash in vHash with a fake value, breaking the merkle root computation
    • Empty hash list: clear vHash entirely
    • Flipped bit path: invert the first bit in vBits, changing which transaction the proof claims to include
  2. Update CMakeLists.txt fe033e23ae
  3. Merge branch 'bitcoin:master' into master 00afc8eca9
  4. test: Add P2SH sigop counting test for segwit blocks
    Add tests verifying that P2SH sigop counting works correctly in
    segwit-active blocks. This addresses the TODO at the end of the
    test_witness_sigops subtest.
    
    The positive test creates a P2SH output with a P2PK redeem script
    (1 sigop), mines it, and spends it with a valid signature to
    confirm basic P2SH sigop counting works.
    
    The negative test creates a block containing 101 P2SH inputs with
    high-sigop redeem scripts (200 OP_CHECKSIG each, 200 sigops per
    input). At WITNESS_SCALE_FACTOR=4, each input contributes 800
    sigop cost, totaling 80800 which exceeds MAX_SIGOP_COST (80000).
    The block is verified to be rejected with 'bad-blk-sigops'.
    
    Also updates the cleanup to reference tx_high_fund instead of the
    now-spent tx2 output.
    266fad091e
  5. Merge pull request #1 from dagimabebe/test-p2sh-sigops-segwit
    test: Add P2SH sigop counting test for segwit blocks
    d54560ae28
  6. test: Add more invalid txoutproof variants 2dd732dbbb
  7. DrahtBot added the label Tests on Jul 26, 2026
  8. DrahtBot commented at 8:54 PM on July 26, 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/35817.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  9. l0rinc commented at 9:17 PM on July 26, 2026: contributor

    AI slop, already asked you to pay more attention, please stop spamming!

  10. dagimabebe closed this on Jul 26, 2026

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-07-31 20:50 UTC

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