validation: VerifyDB only needs Consensus::Params

Previously we were passing in CChainParams, when VerifyDB only needed
the Consensus::Params subset.
This commit is contained in:
Carl Dong
2021-09-20 14:02:07 -04:00
parent 4da9c076d1
commit 15f2e33bb3
6 changed files with 18 additions and 16 deletions

View File

@@ -4,7 +4,7 @@
#include <node/chainstate.h>
#include <chainparams.h> // for CChainParams
#include <consensus/params.h> // for Consensus::Params
#include <node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex
#include <validation.h> // for a lot of things
@@ -12,7 +12,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
ChainstateManager& chainman,
CTxMemPool* mempool,
bool fPruneMode,
const CChainParams& chainparams,
const Consensus::Params& consensus_params,
bool fReindexChainState,
int64_t nBlockTreeDBCache,
int64_t nCoinDBCache,
@@ -57,7 +57,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
}
if (!chainman.BlockIndex().empty() &&
!chainman.m_blockman.LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) {
!chainman.m_blockman.LookupBlockIndex(consensus_params.hashGenesisBlock)) {
return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK;
}
@@ -128,7 +128,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManager& chainman,
bool fReset,
bool fReindexChainState,
const CChainParams& chainparams,
const Consensus::Params& consensus_params,
unsigned int check_blocks,
unsigned int check_level,
std::function<int64_t()> get_unix_time_seconds)
@@ -148,7 +148,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
}
if (!CVerifyDB().VerifyDB(
*chainstate, chainparams, chainstate->CoinsDB(),
*chainstate, consensus_params, chainstate->CoinsDB(),
check_level,
check_blocks)) {
return ChainstateLoadVerifyError::ERROR_CORRUPTED_BLOCK_DB;