Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
MempoolAcceptResult Struct Reference

Validation result for a transaction evaluated by MemPoolAccept (single or package). More...

#include <validation.h>

Collaboration diagram for MempoolAcceptResult:
[legend]

Public Types

enum class  ResultType { VALID , INVALID , MEMPOOL_ENTRY , DIFFERENT_WITNESS }
 Used to indicate the results of mempool validation. More...

Static Public Member Functions

static MempoolAcceptResult Failure (TxValidationState state)
static MempoolAcceptResult FeeFailure (TxValidationState state, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
static MempoolAcceptResult Success (std::list< CTransactionRef > &&replaced_txns, int64_t vsize, CAmount fees, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
static MempoolAcceptResult MempoolTx (int64_t vsize, CAmount fees)
static MempoolAcceptResult MempoolTxDifferentWitness (const Wtxid &other_wtxid)

Public Attributes

const ResultType m_result_type
 Result type.
const TxValidationState m_state
 Contains information about why the transaction failed.
const std::list< CTransactionRefm_replaced_transactions
 Mempool transactions replaced by the tx.
const std::optional< int64_t > m_vsize
 Virtual size as used by the mempool, calculated using serialized size and sigops.
const std::optional< CAmountm_base_fees
 Raw base fees in satoshis.
const std::optional< CFeeRatem_effective_feerate
 The feerate at which this transaction was considered.
const std::optional< std::vector< Wtxid > > m_wtxids_fee_calculations
 Contains the wtxids of the transactions used for fee-related checks.
const std::optional< Wtxidm_other_wtxid
 The wtxid of the transaction in the mempool which has the same txid but different witness.

Private Member Functions

 MempoolAcceptResult (TxValidationState state)
 Constructor for failure case.
 MempoolAcceptResult (std::list< CTransactionRef > &&replaced_txns, int64_t vsize, CAmount fees, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
 Constructor for success case.
 MempoolAcceptResult (TxValidationState state, CFeeRate effective_feerate, const std::vector< Wtxid > &wtxids_fee_calculations)
 Constructor for fee-related failure case.
 MempoolAcceptResult (int64_t vsize, CAmount fees)
 Constructor for already-in-mempool case.
 MempoolAcceptResult (const Wtxid &other_wtxid)
 Constructor for witness-swapped case.

Detailed Description

Validation result for a transaction evaluated by MemPoolAccept (single or package).

Here are the expected fields and properties of a result depending on its ResultType, applicable to results returned from package evaluation: +------------------------—+-------------—+----------------—+---------------—+-------------—+----------------—+ | Field or property | VALID | INVALID | MEMPOOL_ENTRY | DIFFERENT_WITNESS | | | |-----------------------------------—| | | | | | TX_RECONSIDERABLE | Other | | | +------------------------—+-------------—+----------------—+---------------—+-------------—+----------------—+ | txid in mempool? | yes | no | no* | yes | yes | | wtxid in mempool? | yes | no | no* | yes | no | | m_state | yes, IsValid() | yes, IsInvalid() | yes, IsInvalid() | yes, IsValid() | yes, IsValid() | | m_vsize | yes | no | no | yes | no | | m_base_fees | yes | no | no | yes | no | | m_effective_feerate | yes | yes | no | no | no | | m_wtxids_fee_calculations | yes | yes | no | no | no | | m_other_wtxid | no | no | no | no | yes | +------------------------—+-------------—+----------------—+---------------—+-------------—+----------------—+ (*) Individual transaction acceptance doesn't return MEMPOOL_ENTRY and DIFFERENT_WITNESS. It returns INVALID, with the errors txn-already-in-mempool and txn-same-nonwitness-data-in-mempool respectively. In those cases, the txid or wtxid may be in the mempool for a TX_CONFLICT.

Definition at line 131 of file validation.h.

Member Enumeration Documentation

◆ ResultType

Used to indicate the results of mempool validation.

Enumerator
VALID 
INVALID 

Fully validated, valid.

MEMPOOL_ENTRY 

Invalid.

DIFFERENT_WITNESS 

Valid, transaction was already in the mempool.

Definition at line 133 of file validation.h.

Constructor & Destructor Documentation

◆ MempoolAcceptResult() [1/5]

MempoolAcceptResult::MempoolAcceptResult ( TxValidationState state)
inlineexplicitprivate

Constructor for failure case.

Definition at line 197 of file validation.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MempoolAcceptResult() [2/5]

MempoolAcceptResult::MempoolAcceptResult ( std::list< CTransactionRef > && replaced_txns,
int64_t vsize,
CAmount fees,
CFeeRate effective_feerate,
const std::vector< Wtxid > & wtxids_fee_calculations )
inlineexplicitprivate

Constructor for success case.

Definition at line 203 of file validation.h.

◆ MempoolAcceptResult() [3/5]

MempoolAcceptResult::MempoolAcceptResult ( TxValidationState state,
CFeeRate effective_feerate,
const std::vector< Wtxid > & wtxids_fee_calculations )
inlineexplicitprivate

Constructor for fee-related failure case.

Definition at line 216 of file validation.h.

◆ MempoolAcceptResult() [4/5]

MempoolAcceptResult::MempoolAcceptResult ( int64_t vsize,
CAmount fees )
inlineexplicitprivate

Constructor for already-in-mempool case.

It wouldn't replace any transactions.

Definition at line 225 of file validation.h.

◆ MempoolAcceptResult() [5/5]

MempoolAcceptResult::MempoolAcceptResult ( const Wtxid & other_wtxid)
inlineexplicitprivate

Constructor for witness-swapped case.

Definition at line 229 of file validation.h.

Member Function Documentation

◆ Failure()

MempoolAcceptResult MempoolAcceptResult::Failure ( TxValidationState state)
inlinestatic

Definition at line 167 of file validation.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FeeFailure()

MempoolAcceptResult MempoolAcceptResult::FeeFailure ( TxValidationState state,
CFeeRate effective_feerate,
const std::vector< Wtxid > & wtxids_fee_calculations )
inlinestatic

Definition at line 171 of file validation.h.

Here is the call graph for this function:

◆ MempoolTx()

MempoolAcceptResult MempoolAcceptResult::MempoolTx ( int64_t vsize,
CAmount fees )
inlinestatic

Definition at line 186 of file validation.h.

Here is the call graph for this function:

◆ MempoolTxDifferentWitness()

MempoolAcceptResult MempoolAcceptResult::MempoolTxDifferentWitness ( const Wtxid & other_wtxid)
inlinestatic

Definition at line 190 of file validation.h.

Here is the call graph for this function:

◆ Success()

MempoolAcceptResult MempoolAcceptResult::Success ( std::list< CTransactionRef > && replaced_txns,
int64_t vsize,
CAmount fees,
CFeeRate effective_feerate,
const std::vector< Wtxid > & wtxids_fee_calculations )
inlinestatic

Definition at line 177 of file validation.h.

Here is the call graph for this function:

Member Data Documentation

◆ m_base_fees

const std::optional<CAmount> MempoolAcceptResult::m_base_fees

Raw base fees in satoshis.

Definition at line 150 of file validation.h.

◆ m_effective_feerate

const std::optional<CFeeRate> MempoolAcceptResult::m_effective_feerate

The feerate at which this transaction was considered.

This includes any fee delta added using prioritisetransaction (i.e. modified fees). If this transaction was submitted as a package, this is the package feerate, which may also include its descendants and/or ancestors (see m_wtxids_fee_calculations below).

Definition at line 156 of file validation.h.

◆ m_other_wtxid

const std::optional<Wtxid> MempoolAcceptResult::m_other_wtxid

The wtxid of the transaction in the mempool which has the same txid but different witness.

Definition at line 165 of file validation.h.

◆ m_replaced_transactions

const std::list<CTransactionRef> MempoolAcceptResult::m_replaced_transactions

Mempool transactions replaced by the tx.

Definition at line 146 of file validation.h.

◆ m_result_type

const ResultType MempoolAcceptResult::m_result_type

Result type.

Present in all MempoolAcceptResults.

Definition at line 140 of file validation.h.

◆ m_state

const TxValidationState MempoolAcceptResult::m_state

Contains information about why the transaction failed.

Definition at line 143 of file validation.h.

◆ m_vsize

const std::optional<int64_t> MempoolAcceptResult::m_vsize

Virtual size as used by the mempool, calculated using serialized size and sigops.

Definition at line 148 of file validation.h.

◆ m_wtxids_fee_calculations

const std::optional<std::vector<Wtxid> > MempoolAcceptResult::m_wtxids_fee_calculations

Contains the wtxids of the transactions used for fee-related checks.

Includes this transaction's wtxid and may include others if this transaction was validated as part of a package. This is not necessarily equivalent to the list of transactions passed to ProcessNewPackage(). Only present when m_result_type = ResultType::VALID.

Definition at line 162 of file validation.h.


The documentation for this struct was generated from the following file: