validation: Remove global ::ActivateBestChain

Instead use CChainState::ActivateBestChain, which is what the global one
calls anyway.
This commit is contained in:
Carl Dong
2020-09-15 15:26:36 -04:00
parent 2a696472a1
commit 5f8cd7b3a5
5 changed files with 9 additions and 18 deletions

View File

@ -167,13 +167,6 @@ void StopScriptCheckWorkerThreads();
* @returns The tx if found, otherwise nullptr
*/
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock);
/**
* 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(BlockValidationState& state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>());
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
@ -648,6 +641,8 @@ public:
void PruneAndFlush();
/**
* Find the best known block, and make it the tip of the block chain
*
* 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).
@ -664,7 +659,7 @@ public:
bool ActivateBestChain(
BlockValidationState& state,
const CChainParams& chainparams,
std::shared_ptr<const CBlock> pblock) LOCKS_EXCLUDED(cs_main);
std::shared_ptr<const CBlock> pblock = nullptr) LOCKS_EXCLUDED(cs_main);
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);