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

Merge bitcoin/bitcoin#36931: test: cover negative output after positive in CheckTransaction

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#36931: test: cover negative output after positive in CheckTransaction

8e7e39d63ffb8c4bc5759648f46f94c7db840a21 test: cover negative output after positive in CheckTransaction (ViniciusCestarii)

Pull request description:

Kills mutant https://mutanthub.space/mutants/4675:

```diff
diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp
index 473538e..d484547 100644
--- a/src/consensus/tx_check.cpp
+++ b/src/consensus/tx_check.cpp
@@ -32,11 +32,11 @@ bool CheckTransaction(const CTransaction& tx, TxValidationState& state)
CAmount nValueOut = 0;
for (const auto& txout : tx.vout)
{
- if (txout.nValue < 0)
+ nValueOut += txout.nValue;
+ if (nValueOut < 0)
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-negative");
if (txout.nValue > MAX_MONEY)
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-toolarge");
- nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-txouttotal-toolarge");
}
```

This mutant could lead to an inflation bug, and the only other check that prevents that is in `GetValueOut`.

ACKs for top commit:
mercie-ux:
re-ACK [8e7e39d](https://github.com/bitcoin/bitcoin/commit/8e7e39d63ffb8c4bc5759648f46f94c7db840a21)
nebula-21:
tACK 8e7e39d63ffb8c4bc5759648f46f94c7db840a21
brunoerg:
ACK 8e7e39d63ffb8c4bc5759648f46f94c7db840a21
sedited:
ACK 8e7e39d63ffb8c4bc5759648f46f94c7db840a21

Tree-SHA512: 1ee114851c2a38742b02400b5243245d39314679f5bf21371c1abc86f9db19da282c4806325bb6b82a32400e76b050d632dfc8d8e776856469a8694db25c3ae1
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit only adds a new test case to Bitcoin Core's test data. It does not change any production code. The test verifies that a transaction containing a positive output followed by a negative output is correctly rejected as invalid. The accompanying pull request discussion explains this test 'kills' a hypothetical code mutation that could, if it actually existed in the software, lead to an inflation bug. But the mutation is not present in the code being committed; the commit merely improves test coverage.

Recommended action

No action required. This is a test-only addition that improves coverage. Reviewers may consider whether the new test vector is also exercised by the unit tests that consume tx_invalid.json.

Security signals we found

01

Adds regression test for negative transaction output following a positive output

02

PR description references a hypothetical mutation that could lead to an inflation bug if present in consensus code

03

No change to src/consensus/tx_check.cpp or any production code path

Risk score

Why this scored 12/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 8/10
Evidence quality 4/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.