mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 09:46:14 +00:00
consensus/doc: explain GetValueOut() precondition
`Consensus::CheckTxInputs` calls `tx.GetValueOut()` and assumes output-range checks already ran. Document the mempool and block validation call paths where this is guaranteed. Co-authored-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
parent
82ef92c8d0
commit
8c03318387
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user