Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* If you want to *possibly* get feedback on whether pblock is valid, you must | * If you want to *possibly* get feedback on whether pblock is valid, you must | ||||
* install a CValidationInterface (see validationinterface.h) - this will have | * install a CValidationInterface (see validationinterface.h) - this will have | ||||
* its BlockChecked method called whenever *any* block completes validation. | * its BlockChecked method called whenever *any* block completes validation. | ||||
* | * | ||||
* Note that we guarantee that either the proof-of-work is valid on pblock, or | * Note that we guarantee that either the proof-of-work is valid on pblock, or | ||||
* (and possibly also) BlockChecked will have been called. | * (and possibly also) BlockChecked will have been called. | ||||
* | * | ||||
* Call without cs_main held. | * May not be called with cs_main held. 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. | * @return True if the block is accepted as a valid block. | ||||
*/ | */ | ||||
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); | ||||
/** | /** | ||||
* Process incoming block headers. | * Process incoming block headers. | ||||
* | * | ||||
* Call without cs_main held. | * May not be called with cs_main held. May not be called in a | ||||
* validationinterface callback. | |||||
* | * | ||||
* @param[in] config The config. | * @param[in] config The config. | ||||
* @param[in] block The block headers themselves. | * @param[in] block The block headers themselves. | ||||
* @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 headers. | * last new block index object for the given headers. | ||||
* @param[out] first_invalid First header that fails validation, if one exists. | * @param[out] first_invalid First header that fails validation, if one exists. | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
* Retrieve a transaction (from memory pool, or from disk, if possible). | * Retrieve a transaction (from memory pool, or from disk, if possible). | ||||
*/ | */ | ||||
bool GetTransaction(const Consensus::Params ¶ms, const TxId &txid, | bool GetTransaction(const Consensus::Params ¶ms, const TxId &txid, | ||||
CTransactionRef &tx, uint256 &hashBlock, | CTransactionRef &tx, uint256 &hashBlock, | ||||
bool fAllowSlow = false, CBlockIndex *blockIndex = nullptr); | bool fAllowSlow = false, CBlockIndex *blockIndex = nullptr); | ||||
/** | /** | ||||
* Find the best known block, and make it the tip of the block chain | * Find the best known block, and make it the tip of the block chain | ||||
* | |||||
* May not be called with cs_main held. May not be called in a | |||||
* validationinterface callback. | |||||
*/ | */ | ||||
bool ActivateBestChain( | bool ActivateBestChain( | ||||
const Config &config, CValidationState &state, | const Config &config, CValidationState &state, | ||||
std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()); | std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()); | ||||
Amount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams); | Amount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams); | ||||
/** | /** | ||||
* Guess verification progress (as a fraction between 0.0=genesis and | * Guess verification progress (as a fraction between 0.0=genesis and | ||||
▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | |||||
/** Replay blocks that aren't fully applied to the database. */ | /** Replay blocks that aren't fully applied to the database. */ | ||||
bool ReplayBlocks(const Consensus::Params ¶ms, CCoinsView *view); | bool ReplayBlocks(const Consensus::Params ¶ms, CCoinsView *view); | ||||
/** Find the last common block between the parameter chain and a locator. */ | /** Find the last common block between the parameter chain and a locator. */ | ||||
CBlockIndex *FindForkInGlobalIndex(const CChain &chain, | CBlockIndex *FindForkInGlobalIndex(const CChain &chain, | ||||
const CBlockLocator &locator); | const CBlockLocator &locator); | ||||
/** Mark a block as precious and reorganize. */ | /** | ||||
* Mark a block as precious and reorganize. | |||||
* | |||||
* May not be called with cs_main held. May not be called in a | |||||
* validationinterface callback. | |||||
*/ | |||||
bool PreciousBlock(const Config &config, CValidationState &state, | bool PreciousBlock(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindex); | CBlockIndex *pindex); | ||||
/** | /** | ||||
* Mark a block as finalized. | * Mark a block as finalized. | ||||
* A finalized block can not be reorged in any way. | * A finalized block can not be reorged in any way. | ||||
*/ | */ | ||||
bool FinalizeBlockAndInvalidate(const Config &config, CValidationState &state, | bool FinalizeBlockAndInvalidate(const Config &config, CValidationState &state, | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |