Consensus::CheckTxInputs

Check whether all inputs of this transaction are valid (no double spends and amounts) This does not modify the UTXO set. This does not check scripts and sigs.

Synopsis

Declared in <consensus/tx_verify.h>

[[nodiscard]]
bool
CheckTxInputs(
    CTransaction const& tx,
    TxValidationState& state,
    CCoinsViewCache const& inputs,
    int nSpendHeight,
    CAmount& txfee);

Return Value

true if all inputs exist, are spendable, and amounts balance.

NOTE

The return value should not be discarded.

Parameters

NameDescription
txfee [out]Set to the transaction fee if successful. Preconditions: tx.IsCoinBase() is false.
txThe non-coinbase transaction whose inputs are checked.
stateReceives the validation result and rejection reason on failure.
inputsUTXO set view providing the outputs spent by tx.
nSpendHeightHeight at which tx is being spent, used for maturity checks.