@@ -18,11 +18,12 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
18
18
NodeContext& node,
19
19
bool fPruneMode ,
20
20
const CChainParams& chainparams,
21
- const ArgsManager& args,
22
21
bool fReindexChainState ,
23
22
int64_t nBlockTreeDBCache,
24
23
int64_t nCoinDBCache,
25
- int64_t nCoinCacheUsage)
24
+ int64_t nCoinCacheUsage,
25
+ unsigned int check_blocks,
26
+ unsigned int check_level)
26
27
{
27
28
auto is_coinsview_empty = [&](CChainState* chainstate) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
28
29
return fReset || fReindexChainState || chainstate->CoinsTip ().GetBestBlock ().IsNull ();
@@ -140,7 +141,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
140
141
for (CChainState* chainstate : chainman.GetAll ()) {
141
142
if (!is_coinsview_empty (chainstate)) {
142
143
uiInterface.InitMessage (_ (" Verifying blocks…" ).translated );
143
- if (fHavePruned && args. GetIntArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
144
+ if (fHavePruned && check_blocks > MIN_BLOCKS_TO_KEEP) {
144
145
LogPrintf (" Prune: pruned datadir may not have more than %d blocks; only checking available blocks\n " ,
145
146
MIN_BLOCKS_TO_KEEP);
146
147
}
@@ -153,8 +154,8 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
153
154
154
155
if (!CVerifyDB ().VerifyDB (
155
156
*chainstate, chainparams, chainstate->CoinsDB (),
156
- args. GetIntArg ( " -checklevel " , DEFAULT_CHECKLEVEL) ,
157
- args. GetIntArg ( " -checkblocks " , DEFAULT_CHECKBLOCKS) )) {
157
+ check_level ,
158
+ check_blocks )) {
158
159
return ChainstateLoadingError::ERROR_CORRUPTED_BLOCK_DB;
159
160
}
160
161
}
0 commit comments