Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 1,205 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* If a block header hasn't already been seen, call CheckBlockHeader on it, | * If a block header hasn't already been seen, call CheckBlockHeader on it, | ||||
* ensure that it doesn't descend from an invalid block, and then add it to | * ensure that it doesn't descend from an invalid block, and then add it to | ||||
* m_block_index. | * m_block_index. | ||||
* Caller must set min_pow_checked=true in order to add a new header to the | * Caller must set min_pow_checked=true in order to add a new header to the | ||||
* block index (permanent memory storage), indicating that the header is | * block index (permanent memory storage), indicating that the header is | ||||
* known to be part of a sufficiently high-work chain (anti-dos check). | * known to be part of a sufficiently high-work chain (anti-dos check). | ||||
*/ | */ | ||||
bool AcceptBlockHeader(const Config &config, const CBlockHeader &block, | bool AcceptBlockHeader(const CBlockHeader &block, | ||||
BlockValidationState &state, CBlockIndex **ppindex, | BlockValidationState &state, CBlockIndex **ppindex, | ||||
bool min_pow_checked) | bool min_pow_checked) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
friend Chainstate; | friend Chainstate; | ||||
//! Returns nullptr if no snapshot has been loaded. | //! Returns nullptr if no snapshot has been loaded. | ||||
const CBlockIndex *GetSnapshotBaseBlock() const | const CBlockIndex *GetSnapshotBaseBlock() const | ||||
EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | public: | ||||
* will have its BlockChecked method called whenever *any* block completes | * will have its BlockChecked method called whenever *any* block completes | ||||
* validation. | * validation. | ||||
* | * | ||||
* Note that we guarantee that either the proof-of-work is valid on block, | * Note that we guarantee that either the proof-of-work is valid on block, | ||||
* or (and possibly also) BlockChecked will have been called. | * or (and possibly also) BlockChecked will have been called. | ||||
* | * | ||||
* May not be called in a validationinterface callback. | * May not be called in a validationinterface callback. | ||||
* | * | ||||
* @param[in] config The global config. | |||||
* @param[in] block The block we want to process. | * @param[in] block The block we want to process. | ||||
* @param[in] force_processing Process this block even if unrequested; | * @param[in] force_processing Process this block even if unrequested; | ||||
* used for non-network block sources. | * used for non-network block sources. | ||||
* @param[in] min_pow_checked True if proof-of-work anti-DoS checks have | * @param[in] min_pow_checked True if proof-of-work anti-DoS checks have | ||||
* been done by caller for headers chain | * been done by caller for headers chain | ||||
* (note: only affects headers acceptance; if | * (note: only affects headers acceptance; if | ||||
* block header is already present in block | * block header is already present in block | ||||
* index then this parameter has no effect) | * index then this parameter has no effect) | ||||
* @param[out] new_block A boolean which is set to indicate if the block | * @param[out] new_block A boolean which is set to indicate if the block | ||||
* was first received via this call. | * was first received via this call. | ||||
* @returns If the block was processed, independently of block validity | * @returns If the block was processed, independently of block validity | ||||
*/ | */ | ||||
bool ProcessNewBlock(const Config &config, | bool ProcessNewBlock(const std::shared_ptr<const CBlock> &block, | ||||
const std::shared_ptr<const CBlock> &block, | |||||
bool force_processing, bool min_pow_checked, | bool force_processing, bool min_pow_checked, | ||||
bool *new_block) LOCKS_EXCLUDED(cs_main); | bool *new_block) LOCKS_EXCLUDED(cs_main); | ||||
/** | /** | ||||
* Process incoming block headers. | * Process incoming block headers. | ||||
* | * | ||||
* May not be called in a validationinterface callback. | * May not be called in a validationinterface callback. | ||||
* | * | ||||
* @param[in] config The config. | |||||
* @param[in] block The block headers themselves. | * @param[in] block The block headers themselves. | ||||
* @param[in] min_pow_checked True if proof-of-work anti-DoS checks have | * @param[in] min_pow_checked True if proof-of-work anti-DoS checks have | ||||
* been done by caller for headers chain | * been done by caller for headers chain | ||||
* @param[out] state This may be set to an Error state if any error | * @param[out] state This may be set to an Error state if any error | ||||
* occurred processing them. | * occurred processing them. | ||||
* @param[out] ppindex If set, the pointer will be set to point to the | * @param[out] ppindex If set, the pointer will be set to point to the | ||||
* last new block index object for the given | * last new block index object for the given | ||||
* headers. | * headers. | ||||
* @return True if block headers were accepted as valid. | * @return True if block headers were accepted as valid. | ||||
*/ | */ | ||||
bool ProcessNewBlockHeaders(const Config &config, | bool ProcessNewBlockHeaders(const std::vector<CBlockHeader> &block, | ||||
const std::vector<CBlockHeader> &block, | |||||
bool min_pow_checked, | bool min_pow_checked, | ||||
BlockValidationState &state, | BlockValidationState &state, | ||||
const CBlockIndex **ppindex = nullptr) | const CBlockIndex **ppindex = nullptr) | ||||
LOCKS_EXCLUDED(cs_main); | LOCKS_EXCLUDED(cs_main); | ||||
/** | /** | ||||
* Try to add a transaction to the memory pool. | * Try to add a transaction to the memory pool. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |