Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | struct MempoolAcceptResult { | ||||
* including the possibility of unfinished validation. | * including the possibility of unfinished validation. | ||||
*/ | */ | ||||
enum class ResultType { | enum class ResultType { | ||||
//! Fully validated, valid. | //! Fully validated, valid. | ||||
VALID, | VALID, | ||||
//! Invalid. | //! Invalid. | ||||
INVALID, | INVALID, | ||||
}; | }; | ||||
ResultType m_result_type; | const ResultType m_result_type; | ||||
TxValidationState m_state; | const TxValidationState m_state; | ||||
// The following fields are only present when m_result_type = | // The following fields are only present when m_result_type = | ||||
// ResultType::VALID | // ResultType::VALID | ||||
/** Raw base fees. */ | /** Raw base fees in satoshis. */ | ||||
std::optional<Amount> m_base_fees; | const std::optional<Amount> m_base_fees; | ||||
/** Constructor for failure case */ | /** Constructor for failure case */ | ||||
explicit MempoolAcceptResult(TxValidationState state) | explicit MempoolAcceptResult(TxValidationState state) | ||||
: m_result_type(ResultType::INVALID), m_state(state), | : m_result_type(ResultType::INVALID), m_state(state), | ||||
m_base_fees(std::nullopt) { | m_base_fees(std::nullopt) { | ||||
// Can be invalid or error | // Can be invalid or error | ||||
Assume(!state.IsValid()); | Assume(!state.IsValid()); | ||||
} | } | ||||
/** Constructor for success case */ | /** Constructor for success case */ | ||||
explicit MempoolAcceptResult(Amount fees) | explicit MempoolAcceptResult(Amount fees) | ||||
: m_result_type(ResultType::VALID), m_state(TxValidationState{}), | : m_result_type(ResultType::VALID), m_base_fees(fees) {} | ||||
m_base_fees(fees) {} | |||||
}; | }; | ||||
/** | /** | ||||
* (try to) add transaction to memory pool | * (try to) add transaction to memory pool | ||||
* | * | ||||
* @param[in] bypass_limits When true, don't enforce mempool fee limits. | * @param[in] bypass_limits When true, don't enforce mempool fee limits. | ||||
* @param[in] test_accept When true, run validation checks but don't submit | * @param[in] test_accept When true, run validation checks but don't submit | ||||
* to mempool. | * to mempool. | ||||
▲ Show 20 Lines • Show All 1,049 Lines • Show Last 20 Lines |