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 alive.
--- 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.