Kills mutant https://mutanthub.space/mutants/4675:
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.