In Consensus::CheckTxInputs, for every input coin, if either coin.out.nValue or nValueIn is out of range, the transaction is invalid. The current checktxinputs_invalid_transactions_test only cover 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/5d93087c6abbda758baf3d49c552e6dc259d5021 adds a test case with multiple valid inputs, whose sum exceed MAX_MONEY, while also having nValueIn != coin.out.nValue, killing the mutant.