test: cover BIP30 for non coinbase txs #36847

pull ViniciusCestarii wants to merge 1 commits into bitcoin:master from ViniciusCestarii:test-bip30-non-coinbase changing 1 files +50 −17
  1. ViniciusCestarii commented at 3:19 PM on November 12, 2026: contributor

    The BIP30 tests in feature_block.py only cover duplicate coinbase transactions, but the check applies to every transaction in a block.

    Add coverage for a duplicate non-coinbase transaction:

    • tx A spends coinbase C
    • a duplicate of C is mined and matures, so A can be included again
    • re-including A is rejected while A's outputs are unspent
    • re-including A is accepted after A's outputs are spent

    Kills the following mutant (https://mutanthub.space/mutants/4389):

    diff --git a/src/validation.cpp b/src/validation.cpp
    index 6bed39ba5f..a8a6b46b3d 100644
    --- a/src/validation.cpp
    +++ b/src/validation.cpp
    @@ -2538,12 +2538,11 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
         // consensus change that ensures coinbases at those heights cannot
         // duplicate earlier coinbases.
         if (fEnforceBIP30 || pindex->nHeight >= BIP34_IMPLIES_BIP30_LIMIT) {
    -        for (const auto& tx : block.vtx) {
    -            for (size_t o = 0; o < tx->vout.size(); o++) {
    -                if (view.HaveCoin(COutPoint(tx->GetHash(), o))) {
    -                    state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-txns-BIP30",
    -                                  "tried to overwrite transaction");
    -                }
    +        const CTransaction& coinbase{*block.vtx[0]};
    +        for (size_t o = 0; o < coinbase.vout.size(); o++) {
    +            if (view.HaveCoin(COutPoint(coinbase.GetHash(), o))) {
    +                state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-txns-BIP30",
    +                              "tried to overwrite transaction");
                 }
             }
         }
    
  2. test: cover BIP30 for non coinbase txs 404d102878
  3. DrahtBot added the label Tests on Nov 12, 2026
  4. DrahtBot commented at 3:19 PM on November 12, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK KY-U
    Concept ACK johnnyasantoss

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35793 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35793.svg"></sub> (Implement BIP 54 (Consensus Cleanup) without mainnet activation by darosior)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. l0rinc commented at 9:19 AM on November 13, 2026: contributor

    Not sure this is important, in fact I think we should completely remove the BIP30 checks during assumevalid (and sigop counting, see #36476). That doesn't necessarily contradict adding new tests for it, but doesn't seem like a priority to me.

  6. ViniciusCestarii commented at 12:16 PM on November 13, 2026: contributor

    I agree that it is not urgent, but I still think it is worth covering as long as the check exists because it affects consensus. Even with that change, nodes running with -assumevalid=0 would still use BIP 30.

  7. johnnyasantoss commented at 2:12 PM on November 13, 2026: none

    404d102878ad91123ef02db8bad9a3d561f9efe6 tACK. The code exists today, this simply exercises it further.

  8. KY-U commented at 3:28 PM on November 13, 2026: contributor

    tACK 404d102878ad91123ef02db8bad9a3d561f9efe6. Verified the mutant is killed by timeout.

  9. DrahtBot requested review from johnnyasantoss on Nov 13, 2026

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-11-18 16:51 UTC

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