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

@@ -3860,7 +3860,7 @@ CVerifyDB::~CVerifyDB()
bool CVerifyDB::VerifyDB(
CChainState& chainstate,
const CChainParams& chainparams,
const Consensus::Params& consensus_params,
CCoinsView& coinsview,
int nCheckLevel, int nCheckDepth)
{
@@ -3902,10 +3902,10 @@ bool CVerifyDB::VerifyDB(
}
CBlock block;
// check level 0: read from disk
if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus()))
if (!ReadBlockFromDisk(block, pindex, consensus_params))
return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
// check level 1: verify block validity
if (nCheckLevel >= 1 && !CheckBlock(block, state, chainparams.GetConsensus()))
if (nCheckLevel >= 1 && !CheckBlock(block, state, consensus_params))
return error("%s: *** found bad block at %d, hash=%s (%s)\n", __func__,
pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
// check level 2: verify undo validity
@@ -3953,7 +3953,7 @@ bool CVerifyDB::VerifyDB(
uiInterface.ShowProgress(_("Verifying blocks…").translated, percentageDone, false);
pindex = chainstate.m_chain.Next(pindex);
CBlock block;
if (!ReadBlockFromDisk(block, pindex, chainparams.GetConsensus()))
if (!ReadBlockFromDisk(block, pindex, consensus_params))
return error("VerifyDB(): *** ReadBlockFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
if (!chainstate.ConnectBlock(block, state, pindex, coins)) {
return error("VerifyDB(): *** found unconnectable block at %d, hash=%s (%s)", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());