Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | |||||
/** Prune block files up to a given height */ | /** Prune block files up to a given height */ | ||||
void PruneBlockFilesManual(CChainState &active_chainstate, | void PruneBlockFilesManual(CChainState &active_chainstate, | ||||
int nManualPruneHeight); | int nManualPruneHeight); | ||||
/** | /** | ||||
* Validation result for a single transaction mempool acceptance. | * Validation result for a single transaction mempool acceptance. | ||||
*/ | */ | ||||
struct MempoolAcceptResult { | struct MempoolAcceptResult { | ||||
/** | /** Used to indicate the results of mempool validation. */ | ||||
* Used to indicate the results of mempool 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, | ||||
}; | }; | ||||
const ResultType m_result_type; | const ResultType m_result_type; | ||||
const 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 in satoshis. */ | /** Raw base fees in satoshis. */ | ||||
const std::optional<Amount> m_base_fees; | const std::optional<Amount> m_base_fees; | ||||
static MempoolAcceptResult Failure(TxValidationState state) { | |||||
return MempoolAcceptResult(state); | |||||
} | |||||
static MempoolAcceptResult Success(Amount fees) { | |||||
return MempoolAcceptResult(fees); | |||||
} | |||||
// Private constructors. Use static methods MempoolAcceptResult::Success, | |||||
// etc. to construct. | |||||
private: | |||||
/** 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()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,077 Lines • Show Last 20 Lines |