AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 14 Bitcoin

Merge bitcoin/bitcoin#36686: test: cover cumulative input value range in CheckTxInput tests.

Public commit record

What the developer wrote

Authored by merge-script

96/100 · Strong
Merge bitcoin/bitcoin#36686: test: cover cumulative input value range in CheckTxInput tests.

98f9eb6afdfd2bb1cd2872bd7d2eb439ec2043a1 test: cover negative input in CheckTxInputs (KY-U)
133714d1695bc40277b213afd252c3e320cac73e test: cover cumulative input value range in CheckTxInputs (KY-U)
f8c6cd84e08043f206ca338d0ba7e4dc8bef5214 test: support multiple inputs in CheckTxInputs test helper (KY-U)

Pull request description:

In `Consensus::CheckTxInputs`, the inputs are invalid if, for every input coin, either `coin.out.nValue` or `nValueIn` is out of range. However, the current `checktxinputs_invalid_transactions_test` only covers cases with one input, so the sum `nValueIn` is always equal to `coin.out.nValue`, leaving the [following mutant](https://mutanthub.space/mutants/275) alive.
```diff
--- a/src/consensus/tx_verify.cpp
+++ b/src/consensus/tx_verify.cpp
@@ -189,7 +189,7 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, TxValidationState& state,

// Check for negative or overflow input values
nValueIn += coin.out.nValue;
- if (!MoneyRange(coin.out.nValue) || !MoneyRange(nValueIn)) {
+ if (!MoneyRange(coin.out.nValue) && !MoneyRange(nValueIn)) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-inputvalues-outofrange");
}
}
```
https://github.com/bitcoin/bitcoin/pull/36686/commits/f8c6cd84e08043f206ca338d0ba7e4dc8bef5214 adds support for multiple inputs in the test helper.

https://github.com/bitcoin/bitcoin/pull/36686/commits/133714d1695bc40277b213afd252c3e320cac73e adds a test case with multiple valid inputs, whose sum exceed `MAX_MONEY`, while also having `nValueIn` != `coin.out.nValue`, killing the mutant.

https://github.com/bitcoin/bitcoin/pull/36686/commits/98f9eb6afdfd2bb1cd2872bd7d2eb439ec2043a1 adds a test for uncovered negative input case.

ACKs for top commit:
mercie-ux:
reACK 98f9eb6afdfd2bb1cd2872bd7d2eb439ec2043a1
ViniciusCestarii:
ACK 98f9eb6afdfd2bb1cd2872bd7d2eb439ec2043a1 nice!
sedited:
ACK 98f9eb6afdfd2bb1cd2872bd7d2eb439ec2043a1

Tree-SHA512: 1199a03bcc85ee56317f0d3089c03a3dd3116868630174c0ee26523c9e6d86370065e830a476e1c573b2504e5c45487c77d50e25e64f2e20e7c1dadaa12eb2b4
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit only adds new test cases to Bitcoin Core's test suite. It does not change any production consensus, validation, or networking code. The tests verify that an existing check in the transaction validation logic correctly rejects transactions with out-of-range input values, including cases with multiple inputs. There is no security vulnerability being fixed here—only test coverage is being improved.

Recommended action

No security action required. This is a routine test-coverage improvement. Reviewers may verify the new test cases correctly exercise the intended consensus paths.

Security signals we found

01

No production code changes

02

Test-only commit

03

Adds regression tests for existing consensus input-value range check

04

No vulnerability patch present

Risk score

Why this scored 14/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.