Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | |||||
* May not be called in a validationinterface callback. | * May not be called in a validationinterface callback. | ||||
* | * | ||||
* @param[in] config The global config. | * @param[in] config The global config. | ||||
* @param[in] pblock The block we want to process. | * @param[in] pblock The block we want to process. | ||||
* @param[in] fForceProcessing Process this block even if unrequested; used | * @param[in] fForceProcessing Process this block even if unrequested; used | ||||
* for non-network block sources and whitelisted peers. | * for non-network block sources and whitelisted peers. | ||||
* @param[out] fNewBlock A boolean which is set to indicate if the block was | * @param[out] fNewBlock A boolean which is set to indicate if the block was | ||||
* first received via this call. | * first received via this call. | ||||
* @return True if the block is accepted as a valid block. | * @returns If the block was processed, independently of block validity | ||||
*/ | */ | ||||
bool ProcessNewBlock(const Config &config, | bool ProcessNewBlock(const Config &config, | ||||
const std::shared_ptr<const CBlock> pblock, | const std::shared_ptr<const CBlock> pblock, | ||||
bool fForceProcessing, bool *fNewBlock) | bool fForceProcessing, bool *fNewBlock) | ||||
LOCKS_EXCLUDED(cs_main); | LOCKS_EXCLUDED(cs_main); | ||||
/** | /** | ||||
* Process incoming block headers. | * Process incoming block headers. | ||||
▲ Show 20 Lines • Show All 599 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Update the on-disk chain state. | * Update the on-disk chain state. | ||||
* The caches and indexes are flushed depending on the mode we're called | * The caches and indexes are flushed depending on the mode we're called | ||||
* with if they're too large, if it's been a while since the last write, or | * with if they're too large, if it's been a while since the last write, or | ||||
* always and in all cases if we're in prune mode and are deleting files. | * always and in all cases if we're in prune mode and are deleting files. | ||||
* | * | ||||
* If FlushStateMode::NONE is used, then FlushStateToDisk(...) won't do | * If FlushStateMode::NONE is used, then FlushStateToDisk(...) won't do | ||||
* anything besides checking if we need to prune. | * anything besides checking if we need to prune. | ||||
* | |||||
* @returns true unless a system error occurred | |||||
*/ | */ | ||||
bool FlushStateToDisk(const CChainParams &chainparams, | bool FlushStateToDisk(const CChainParams &chainparams, | ||||
BlockValidationState &state, FlushStateMode mode, | BlockValidationState &state, FlushStateMode mode, | ||||
int nManualPruneHeight = 0); | int nManualPruneHeight = 0); | ||||
//! Unconditionally flush all changes to disk. | //! Unconditionally flush all changes to disk. | ||||
void ForceFlushStateToDisk(); | void ForceFlushStateToDisk(); | ||||
//! Prune blockfiles from the disk if necessary and then flush chainstate | //! Prune blockfiles from the disk if necessary and then flush chainstate | ||||
//! changes if we pruned. | //! changes if we pruned. | ||||
void PruneAndFlush(); | void PruneAndFlush(); | ||||
/** | |||||
* Make the best chain active, in multiple steps. The result is either | |||||
* failure or an activated best chain. pblock is either nullptr or a pointer | |||||
* to a block that is already loaded (to avoid loading it again from disk). | |||||
* | |||||
* ActivateBestChain is split into steps (see ActivateBestChainStep) so that | |||||
* we avoid holding cs_main for an extended period of time; the length of | |||||
* this call may be quite long during reindexing or a substantial reorg. | |||||
* | |||||
* @returns true unless a system error occurred | |||||
*/ | |||||
bool ActivateBestChain( | bool ActivateBestChain( | ||||
const Config &config, BlockValidationState &state, | const Config &config, BlockValidationState &state, | ||||
std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()) | std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()) | ||||
LOCKS_EXCLUDED(cs_main); | LOCKS_EXCLUDED(cs_main); | ||||
bool AcceptBlock(const Config &config, | bool AcceptBlock(const Config &config, | ||||
const std::shared_ptr<const CBlock> &pblock, | const std::shared_ptr<const CBlock> &pblock, | ||||
BlockValidationState &state, bool fRequested, | BlockValidationState &state, bool fRequested, | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |