diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index ec612a55e6f..4efed70fd41 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -188,6 +188,10 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, TxValidationState& state, } } + // `tx.GetValueOut()` won't throw in validation paths because output-range checks run first + // (`bad-txns-vout-negative`, `bad-txns-vout-toolarge`, `bad-txns-txouttotal-toolarge`): + // * `MemPoolAccept::PreChecks`: `CheckTransaction()` is called before this method; + // * `Chainstate::ConnectBlock`: `CheckTransaction()` is called via `CheckBlock()` before this method. const CAmount value_out = tx.GetValueOut(); if (nValueIn < value_out) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-in-belowout",