diff --git a/src/init.cpp b/src/init.cpp index 474a31c758..f44373728d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1424,11 +1424,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) node, fPruneMode, chainparams, - args, fReindexChainState, nBlockTreeDBCache, nCoinDBCache, - nCoinCacheUsage); + nCoinCacheUsage, + args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS), + args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL)); if (rv.has_value()) { switch (rv.value()) { case ChainstateLoadingError::ERROR_LOADING_BLOCK_DB: diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index fa39e2442d..3d02c52edb 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -18,11 +18,12 @@ std::optional LoadChainstate(bool fReset, NodeContext& node, bool fPruneMode, const CChainParams& chainparams, - const ArgsManager& args, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, - int64_t nCoinCacheUsage) + int64_t nCoinCacheUsage, + unsigned int check_blocks, + unsigned int check_level) { auto is_coinsview_empty = [&](CChainState* chainstate) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { return fReset || fReindexChainState || chainstate->CoinsTip().GetBestBlock().IsNull(); @@ -140,7 +141,7 @@ std::optional LoadChainstate(bool fReset, for (CChainState* chainstate : chainman.GetAll()) { if (!is_coinsview_empty(chainstate)) { uiInterface.InitMessage(_("Verifying blocks…").translated); - if (fHavePruned && args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) { + if (fHavePruned && check_blocks > MIN_BLOCKS_TO_KEEP) { LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks\n", MIN_BLOCKS_TO_KEEP); } @@ -153,8 +154,8 @@ std::optional LoadChainstate(bool fReset, if (!CVerifyDB().VerifyDB( *chainstate, chainparams, chainstate->CoinsDB(), - args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL), - args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS))) { + check_level, + check_blocks)) { return ChainstateLoadingError::ERROR_CORRUPTED_BLOCK_DB; } } diff --git a/src/node/chainstate.h b/src/node/chainstate.h index 921b8d89e5..87aad23e27 100644 --- a/src/node/chainstate.h +++ b/src/node/chainstate.h @@ -8,7 +8,6 @@ #include // for int64_t #include // for std::optional -class ArgsManager; class CChainParams; class ChainstateManager; struct NodeContext; @@ -59,10 +58,11 @@ std::optional LoadChainstate(bool fReset, NodeContext& node, bool fPruneMode, const CChainParams& chainparams, - const ArgsManager& args, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, - int64_t nCoinCacheUsage); + int64_t nCoinCacheUsage, + unsigned int check_blocks, + unsigned int check_level); #endif // BITCOIN_NODE_CHAINSTATE_H