6 #ifndef BITCOIN_CONSENSUS_VALIDATION_H
7 #define BITCOIN_CONSENSUS_VALIDATION_H
88 template <
typename Result>
103 const std::string& reject_reason =
"",
104 const std::string& debug_message =
"")
107 m_reject_reason = reject_reason;
108 m_debug_message = debug_message;
112 bool Error(
const std::string& reject_reason)
115 m_reject_reason = reject_reason;
131 if (!m_debug_message.empty()) {
164 if (!block.
vtx.empty()) {
165 for (
size_t o = 0; o < block.
vtx[0]->vout.size(); o++) {
166 const CTxOut& vout = block.
vtx[0]->vout[o];
181 #endif // BITCOIN_CONSENSUS_VALIDATION_H
static int64_t GetTransactionWeight(const CTransaction &tx)
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...
invalid by consensus rules
bool Error(const std::string &reject_reason)
static const int WITNESS_SCALE_FACTOR
Template for capturing information about block/transaction validation.
We don't have the previous block the checked one is built on.
std::string GetRejectReason() const
invalid proof of work or time too old
CScriptWitness scriptWitness
Only serialized through CTransaction.
network rule violation (DoS value may be set)
BlockValidationResult
A "reason" why a block was invalid, suitable for determining whether the provider of the block should...
transaction was missing some of its inputs
static constexpr size_t MINIMUM_WITNESS_COMMITMENT
Minimum size of a witness commitment structure.
std::vector< std::vector< unsigned char > > stack
violated mempool's fee/size/descendant/RBF/etc limits
inputs (covered by txid) failed policy rules
transaction spends a coinbase too early, or violates locktime/sequence locks
static constexpr int NO_WITNESS_COMMITMENT
Index marker for when no witness commitment is present in a coinbase transaction. ...
initial value. Tx has not yet been rejected
size_t GetSerializeSize(const T &t, int nVersion=0)
std::string GetDebugMessage() const
initial value. Block has not yet been rejected
Invalid by a change to consensus rules more recent than SegWit.
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
Transaction might have a witness prior to SegWit activation, or witness may have been malleated (whic...
this block was cached as being invalid and we didn't store the reason why
An input of a transaction.
static int64_t GetTransactionInputWeight(const CTxIn &txin)
the block failed to meet one of our checkpoints
An output of a transaction.
std::string m_debug_message
Transaction is missing a witness.
invalid by consensus rules (excluding any below reasons)
std::vector< CTransactionRef > vtx
the block's data didn't match the data committed to by the PoW
static const int PROTOCOL_VERSION
network protocol versioning
A block this one builds on is invalid.
std::string ToString() const
Invalid by a change to consensus rules more recent than SegWit.
block timestamp was > 2 hours in the future (or our clock is bad)
std::string m_reject_reason
The basic transaction that is broadcasted on the network and contained in blocks. ...
int GetWitnessCommitmentIndex(const CBlock &block)
Compute at which vout of the block's coinbase transaction the witness commitment occurs, or -1 if not found.
static int64_t GetBlockWeight(const CBlock &block)
Tx already in mempool or conflicts with a tx in the chain (if it conflicts with another tx in mempool...
otherwise didn't meet our local policy rules
TxValidationResult
A "reason" why a transaction was invalid, suitable for determining whether the provider of the transa...