mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-05 19:38:54 +02:00
validation: Make ProcessNewBlock*() members of ChainstateManager
This commit is contained in:
@@ -150,41 +150,6 @@ extern bool fPruneMode;
|
||||
/** Number of MiB of block files that we're trying to stay below. */
|
||||
extern uint64_t nPruneTarget;
|
||||
|
||||
/**
|
||||
* Process an incoming block. This only returns after the best known valid
|
||||
* block is made active. Note that it does not, however, guarantee that the
|
||||
* specific block passed to it has been checked for validity!
|
||||
*
|
||||
* If you want to *possibly* get feedback on whether pblock is valid, you must
|
||||
* install a CValidationInterface (see validationinterface.h) - this will have
|
||||
* its BlockChecked method called whenever *any* block completes validation.
|
||||
*
|
||||
* Note that we guarantee that either the proof-of-work is valid on pblock, or
|
||||
* (and possibly also) BlockChecked will have been called.
|
||||
*
|
||||
* May not be called in a
|
||||
* validationinterface callback.
|
||||
*
|
||||
* @param[in] pblock The block we want to process.
|
||||
* @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources and whitelisted peers.
|
||||
* @param[out] fNewBlock A boolean which is set to indicate if the block was first received via this call
|
||||
* @returns If the block was processed, independently of block validity
|
||||
*/
|
||||
bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, bool* fNewBlock) LOCKS_EXCLUDED(cs_main);
|
||||
|
||||
/**
|
||||
* Process incoming block headers.
|
||||
*
|
||||
* May not be called in a
|
||||
* validationinterface callback.
|
||||
*
|
||||
* @param[in] block The block headers themselves
|
||||
* @param[out] state This may be set to an Error state if any error occurred processing them
|
||||
* @param[in] chainparams The params for the chain we want to connect to
|
||||
* @param[out] ppindex If set, the pointer will be set to point to the last new block index object for the given headers
|
||||
*/
|
||||
bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& block, BlockValidationState& state, const CChainParams& chainparams, const CBlockIndex** ppindex = nullptr) LOCKS_EXCLUDED(cs_main);
|
||||
|
||||
/** Open a block file (blk?????.dat) */
|
||||
FILE* OpenBlockFile(const FlatFilePos &pos, bool fReadOnly = false);
|
||||
/** Translation to a filesystem path */
|
||||
@@ -860,6 +825,41 @@ public:
|
||||
CChain& ValidatedChain() const { return ValidatedChainstate().m_chain; }
|
||||
CBlockIndex* ValidatedTip() const { return ValidatedChain().Tip(); }
|
||||
|
||||
/**
|
||||
* Process an incoming block. This only returns after the best known valid
|
||||
* block is made active. Note that it does not, however, guarantee that the
|
||||
* specific block passed to it has been checked for validity!
|
||||
*
|
||||
* If you want to *possibly* get feedback on whether pblock is valid, you must
|
||||
* install a CValidationInterface (see validationinterface.h) - this will have
|
||||
* its BlockChecked method called whenever *any* block completes validation.
|
||||
*
|
||||
* Note that we guarantee that either the proof-of-work is valid on pblock, or
|
||||
* (and possibly also) BlockChecked will have been called.
|
||||
*
|
||||
* May not be called in a
|
||||
* validationinterface callback.
|
||||
*
|
||||
* @param[in] pblock The block we want to process.
|
||||
* @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources and whitelisted peers.
|
||||
* @param[out] fNewBlock A boolean which is set to indicate if the block was first received via this call
|
||||
* @returns If the block was processed, independently of block validity
|
||||
*/
|
||||
bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, bool* fNewBlock) LOCKS_EXCLUDED(cs_main);
|
||||
|
||||
/**
|
||||
* Process incoming block headers.
|
||||
*
|
||||
* May not be called in a
|
||||
* validationinterface callback.
|
||||
*
|
||||
* @param[in] block The block headers themselves
|
||||
* @param[out] state This may be set to an Error state if any error occurred processing them
|
||||
* @param[in] chainparams The params for the chain we want to connect to
|
||||
* @param[out] ppindex If set, the pointer will be set to point to the last new block index object for the given headers
|
||||
*/
|
||||
bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& block, BlockValidationState& state, const CChainParams& chainparams, const CBlockIndex** ppindex = nullptr) LOCKS_EXCLUDED(cs_main);
|
||||
|
||||
//! Mark one block file as pruned (modify associated database entries)
|
||||
void PruneOneBlockFile(const int fileNumber) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user