 |
Bitcoin Core
23.99.0
P2P Digital Currency
|
Go to the documentation of this file.
6 #ifndef BITCOIN_CONSENSUS_VALIDATION_H
7 #define BITCOIN_CONSENSUS_VALIDATION_H
89 template <
typename Result>
104 const std::string& reject_reason =
"",
105 const std::string& debug_message =
"")
113 bool Error(
const std::string& reject_reason)
165 if (!block.
vtx.empty()) {
166 for (
size_t o = 0; o < block.
vtx[0]->vout.size(); o++) {
167 const CTxOut& vout = block.
vtx[0]->vout[o];
182 #endif // BITCOIN_CONSENSUS_VALIDATION_H
size_t GetSerializeSize(const T &t, int nVersion=0)
An input of a transaction.
@ BLOCK_CACHED_INVALID
this block was cached as being invalid and we didn't store the reason why
@ BLOCK_CONSENSUS
invalid by consensus rules (excluding any below reasons)
@ BLOCK_MUTATED
the block's data didn't match the data committed to by the PoW
@ TX_WITNESS_STRIPPED
Transaction is missing a witness.
std::string GetDebugMessage() const
@ BLOCK_RECENT_CONSENSUS_CHANGE
Invalid by a change to consensus rules more recent than SegWit.
@ BLOCK_TIME_FUTURE
block timestamp was > 2 hours in the future (or our clock is bad)
@ TX_CONFLICT
Tx already in mempool or conflicts with a tx in the chain (if it conflicts with another tx in mempool...
@ TX_NOT_STANDARD
otherwise didn't meet our local policy rules
BlockValidationResult
A "reason" why a block was invalid, suitable for determining whether the provider of the block should...
The basic transaction that is broadcasted on the network and contained in blocks.
std::string ToString() const
CScriptWitness scriptWitness
Only serialized through CTransaction.
@ TX_NO_MEMPOOL
this node does not have a mempool so can't validate the transaction
@ BLOCK_INVALID_PREV
A block this one builds on is invalid.
An output of a transaction.
std::string m_debug_message
static const int SERIALIZE_TRANSACTION_NO_WITNESS
A flag that is ORed into the protocol version to designate that a transaction should be (un)serialize...
static constexpr size_t MINIMUM_WITNESS_COMMITMENT
Minimum size of a witness commitment structure.
int GetWitnessCommitmentIndex(const CBlock &block)
Compute at which vout of the block's coinbase transaction the witness commitment occurs,...
static int64_t GetBlockWeight(const CBlock &block)
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
@ TX_MEMPOOL_POLICY
violated mempool's fee/size/descendant/RBF/etc limits
@ TX_PREMATURE_SPEND
transaction spends a coinbase too early, or violates locktime/sequence locks
@ TX_RESULT_UNSET
initial value. Tx has not yet been rejected
std::string m_reject_reason
@ TX_CONSENSUS
invalid by consensus rules
static int64_t GetTransactionWeight(const CTransaction &tx)
std::vector< CTransactionRef > vtx
@ TX_MISSING_INPUTS
transaction was missing some of its inputs
@ BLOCK_MISSING_PREV
We don't have the previous block the checked one is built on.
@ BLOCK_RESULT_UNSET
initial value. Block has not yet been rejected
static int64_t GetTransactionInputWeight(const CTxIn &txin)
@ BLOCK_INVALID_HEADER
invalid proof of work or time too old
@ TX_INPUTS_NOT_STANDARD
inputs (covered by txid) failed policy rules
@ TX_WITNESS_MUTATED
Transaction might have a witness prior to SegWit activation, or witness may have been malleated (whic...
std::string GetRejectReason() const
TxValidationResult
A "reason" why a transaction was invalid, suitable for determining whether the provider of the transa...
@ M_INVALID
network rule violation (DoS value may be set)
bool Error(const std::string &reject_reason)
@ BLOCK_CHECKPOINT
the block failed to meet one of our checkpoints
static const int WITNESS_SCALE_FACTOR
std::vector< std::vector< unsigned char > > stack
static constexpr int NO_WITNESS_COMMITMENT
Index marker for when no witness commitment is present in a coinbase transaction.
static const int PROTOCOL_VERSION
network protocol versioning
@ TX_RECENT_CONSENSUS_CHANGE
Invalid by a change to consensus rules more recent than SegWit.
Template for capturing information about block/transaction validation.