33 for (
const auto &
txin : tx.
vin) {
49 "bad-txns-nonfinal",
"non-final transaction");
56 "bad-txns-undersize");
121 ->GetMedianTimePast()};
174 "bad-txns-inputs-missingorspent",
179 for (
const auto &
in : tx.
vin) {
189 "bad-txns-premature-spend-of-coinbase",
190 strprintf(
"tried to spend coinbase at depth %d",
198 "bad-txns-inputvalues-outofrange");
214 "bad-txns-fee-outofrange");
bool IsWellingtonEnabled(const Consensus::Params ¶ms, int32_t nHeight)
Check if May 15th, 2023 protocol upgrade has activated.
bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, int32_t nHeight)
Check if Nov 15, 2018 HF has activated using block height.
bool MoneyRange(const Amount nValue)
#define Assert(val)
Identity function.
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
int64_t GetMedianTimePast() const
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
int nHeight
height of the entry in the chain. The genesis block has height 0
CCoinsView that adds a memory cache for transactions to another CCoinsView.
bool HaveInputs(const CTransaction &tx) const
Check whether all prevouts of the transaction are present in the UTXO set represented by this view.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or coinEmpty if not found.
An outpoint - a combination of a transaction hash and an index n into its vout.
The basic transaction that is broadcasted on the network and contained in blocks.
static constexpr int32_t MAX_VERSION
Amount GetValueOut() const
const std::vector< CTxIn > vin
static constexpr int32_t MIN_VERSION
An input of a transaction.
static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG
If this flag set, CTxIn::nSequence is NOT interpreted as a relative lock-time.
static const uint32_t SEQUENCE_LOCKTIME_MASK
If CTxIn::nSequence encodes a relative lock-time, this mask is applied to extract that lock-time from...
static const uint32_t SEQUENCE_FINAL
Setting nSequence to this value for every input in a transaction disables nLockTime.
static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG
If CTxIn::nSequence encodes a relative lock-time and this flag is set, the relative lock-time has uni...
static const int SEQUENCE_LOCKTIME_GRANULARITY
In order to use the same number of bits to encode roughly the same wall-clock duration,...
uint32_t GetHeight() const
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
@ TX_MISSING_INPUTS
transaction was missing some of its inputs
@ TX_PREMATURE_SPEND
transaction spends a coinbase too early, or violates locktime/sequence locks
@ TX_CONSENSUS
invalid by consensus rules
static constexpr unsigned int LOCKTIME_VERIFY_SEQUENCE
Flags for nSequence and nLockTime locks.
static const uint64_t MIN_TX_SIZE
The minimum allowed size for a transaction, in bytes.
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule).
std::string FormatMoney(const Amount amt)
Do not use these functions to represent or parse monetary amounts to or from JSON but use AmountFromV...
bool CheckTxInputs(const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &inputs, int nSpendHeight, Amount &txfee)
Check whether all inputs of this transaction are valid (no double spends and amounts).
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static const unsigned int LOCKTIME_THRESHOLD
size_t GetSerializeSize(const T &t, int nVersion=0)
static constexpr Amount zero() noexcept
Parameters that influence chain consensus.
static bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
bool EvaluateSequenceLocks(const CBlockIndex &block, std::pair< int, int64_t > lockPair)
std::pair< int, int64_t > CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector< int > &prevHeights, const CBlockIndex &block)
Calculates the block height and previous block's median time past at which the transaction will be co...
bool SequenceLocks(const CTransaction &tx, int flags, std::vector< int > &prevHeights, const CBlockIndex &block)
Check if transaction is final per BIP 68 sequence numbers and can be included in a block.
bool ContextualCheckTransaction(const Consensus::Params ¶ms, const CTransaction &tx, TxValidationState &state, int nHeight, int64_t nMedianTimePast)
Context dependent validity checks for non coinbase transactions.
static const int PROTOCOL_VERSION
network protocol versioning