test: add tests in transaction_tests.cpp covering live mutants #36130

pull ViniciusCestarii wants to merge 3 commits into bitcoin:master from ViniciusCestarii:kill-tx_verify-mutants changing 1 files +65 −0
  1. ViniciusCestarii commented at 2:08 PM on August 31, 2026: contributor

    Kills some live mutants on tx_verify.cpp that affect consensus found with https://github.com/ViniciusCestarii/mutant-harness. They are:

    <details> <summary>tx_verify.cpp (killed by 5c35785d6ddda80d5147616342e42d759490e6b9): <code>IsFinalTx</code>: sequence loop returns on the first input instead of requiring all of them</summary>

    diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp
    index e580a9d..46009a6 100644
    --- a/src/consensus/tx_verify.cpp
    +++ b/src/consensus/tx_verify.cpp
    @@ -35,11 +35,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
         // also check that the spending input's nSequence != SEQUENCE_FINAL,
         // ensuring that an unsatisfied nLockTime value will actually cause
         // IsFinalTx() to return false here:
    -    for (const auto& txin : tx.vin) {
    -        if (!(txin.nSequence == CTxIn::SEQUENCE_FINAL))
    -            return false;
    -    }
    -    return true;
    +    return std::ranges::any_of(tx.vin, [](const CTxIn& txin) { return txin.nSequence == CTxIn::SEQUENCE_FINAL; });
     }
     
     std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>& prevHeights, const CBlockIndex& block)
    

    </details>

    <details> <summary>tx_verify.cpp (killed by 8e1f1b01674012277015482222349e184a903348): <code>CalculateSequenceLocks</code>: <code>tx.version >= 2</code> -> <code>tx.version == 2</code></summary>

    diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp
    index e580a9d..0faaa55 100644
    --- a/src/consensus/tx_verify.cpp
    +++ b/src/consensus/tx_verify.cpp
    @@ -54,7 +54,7 @@ std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags
         int nMinHeight = -1;
         int64_t nMinTime = -1;
     
    -    bool fEnforceBIP68 = tx.version >= 2 && flags & LOCKTIME_VERIFY_SEQUENCE;
    +    bool fEnforceBIP68 = tx.version == 2 && flags & LOCKTIME_VERIFY_SEQUENCE;
     
         // Do not enforce sequence numbers as a relative lock time
         // unless we have been instructed to
    

    </details>

    <details> <summary>tx_verify.cpp (killed by 29bbec6e34cec945e1dfe879935503ca6041f313): <code>GetLegacySigOpCount</code>: <code>scriptSig.GetSigOpCount(false)</code> -> <code>GetSigOpCount(true)</code></summary>

    diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp
    index e580a9d..0b98597 100644
    --- a/src/consensus/tx_verify.cpp
    +++ b/src/consensus/tx_verify.cpp
    @@ -120,7 +120,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx)
         unsigned int nSigOps = 0;
         for (const auto& txin : tx.vin)
         {
    -        nSigOps += txin.scriptSig.GetSigOpCount(false);
    +        nSigOps += txin.scriptSig.GetSigOpCount(true);
         }
         for (const auto& txout : tx.vout)
         {
    

    </details>

    Recommend reviewing per commit.

  2. test: cover IsFinalTx requires every input to be SEQUENCE_FINAL 5c35785d6d
  3. test: cover enforce BIP68 to tx versions higher than 2 8e1f1b0167
  4. test: cover legacy sigops count CHECKMULTISIG inaccurately 29bbec6e34
  5. DrahtBot added the label Tests on Aug 31, 2026
  6. DrahtBot commented at 2:08 PM on August 31, 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/36130.

    <!--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-31 17:51 UTC

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