16
16
17
17
std::optional<ChainstateLoadingError>
18
18
LoadChainstate (bool fReset , ChainstateManager &chainman, NodeContext &node,
19
- bool fPruneMode_ , const Config &config, const ArgsManager &args,
20
- bool fReindexChainState , int64_t nBlockTreeDBCache,
21
- int64_t nCoinDBCache, int64_t nCoinCacheUsage) {
19
+ bool fPruneMode_ , const Config &config, bool fReindexChainState ,
20
+ int64_t nBlockTreeDBCache, int64_t nCoinDBCache,
21
+ int64_t nCoinCacheUsage, unsigned int check_blocks,
22
+ unsigned int check_level) {
22
23
const CChainParams &chainparams = config.GetChainParams ();
23
24
24
25
auto is_coinsview_empty =
@@ -147,9 +148,7 @@ LoadChainstate(bool fReset, ChainstateManager &chainman, NodeContext &node,
147
148
if (!is_coinsview_empty (chainstate)) {
148
149
uiInterface.InitMessage (
149
150
_ (" Verifying blocks..." ).translated );
150
- if (fHavePruned &&
151
- args.GetIntArg (" -checkblocks" , DEFAULT_CHECKBLOCKS) >
152
- MIN_BLOCKS_TO_KEEP) {
151
+ if (fHavePruned && check_blocks > MIN_BLOCKS_TO_KEEP) {
153
152
LogPrintf (
154
153
" Prune: pruned datadir may not have more than %d "
155
154
" blocks; only checking available blocks\n " ,
@@ -162,11 +161,9 @@ LoadChainstate(bool fReset, ChainstateManager &chainman, NodeContext &node,
162
161
return ChainstateLoadingError::ERROR_BLOCK_FROM_FUTURE;
163
162
}
164
163
165
- if (!CVerifyDB ().VerifyDB (
166
- *chainstate, config, chainstate->CoinsDB (),
167
- args.GetIntArg (" -checklevel" , DEFAULT_CHECKLEVEL),
168
- args.GetIntArg (" -checkblocks" ,
169
- DEFAULT_CHECKBLOCKS))) {
164
+ if (!CVerifyDB ().VerifyDB (*chainstate, config,
165
+ chainstate->CoinsDB (),
166
+ check_level, check_blocks)) {
170
167
return ChainstateLoadingError::ERROR_CORRUPTED_BLOCK_DB;
171
168
}
172
169
}
0 commit comments