Skip to content

Commit 2e6d9aa

Browse files
dongcarlFabcien
authored andcommitted
Move -checkblocks LogPrintf to AppInitMain
Summary: Partial backport of [[bitcoin/bitcoin#23280 | core#23280]]: bitcoin/bitcoin@8d466a8 Depends on D12572. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D12573
1 parent 9439a96 commit 2e6d9aa

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/init.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -2524,9 +2524,17 @@ bool AppInitMain(Config &config, RPCServer &rpcServer,
25242524
std::optional<ChainstateLoadVerifyError> rv2;
25252525
try {
25262526
uiInterface.InitMessage(_("Verifying blocks…").translated);
2527+
2528+
auto check_blocks =
2529+
args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
2530+
if (fHavePruned && check_blocks > MIN_BLOCKS_TO_KEEP) {
2531+
LogPrintf("Prune: pruned datadir may not have more than %d "
2532+
"blocks; only checking available blocks\n",
2533+
MIN_BLOCKS_TO_KEEP);
2534+
}
2535+
25272536
rv2 = VerifyLoadedChainstate(
2528-
chainman, fReset, fReindexChainState, config,
2529-
args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
2537+
chainman, fReset, fReindexChainState, config, check_blocks,
25302538
args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
25312539
} catch (const std::exception &e) {
25322540
LogPrintf("%s\n", e.what());

src/node/chainstate.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ VerifyLoadedChainstate(ChainstateManager &chainman, bool fReset,
153153

154154
for (CChainState *chainstate : chainman.GetAll()) {
155155
if (!is_coinsview_empty(chainstate)) {
156-
if (fHavePruned && check_blocks > MIN_BLOCKS_TO_KEEP) {
157-
LogPrintf("Prune: pruned datadir may not have more than %d "
158-
"blocks; only checking available blocks\n",
159-
MIN_BLOCKS_TO_KEEP);
160-
}
161-
162156
const CBlockIndex *tip = chainstate->m_chain.Tip();
163157
RPCNotifyBlockChange(tip);
164158
if (tip && tip->nTime > GetTime() + MAX_FUTURE_BLOCK_TIME) {

0 commit comments

Comments
 (0)