Skip to content

Commit

Permalink
Move -checkblocks LogPrintf to AppInitMain
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Dec 16, 2024
1 parent d3345ee commit 94c0ceb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1960,12 +1960,17 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
std::optional<ChainstateLoadVerifyError> rv2;
try {
uiInterface.InitMessage(_("Verifying blocks…").translated);
auto check_blocks = args.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS);
if (chainman.m_blockman.m_have_pruned && 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);
}
rv2 = VerifyLoadedChainstate(chainman,
*Assert(node.evodb.get()),
fReset,
fReindexChainState,
chainparams,
args.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS),
check_blocks,
args.GetArg("-checklevel", DEFAULT_CHECKLEVEL));
} catch (const std::exception& e) {
LogPrintf("%s\n", e.what());
Expand Down
5 changes: 0 additions & 5 deletions src/node/chainstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,6 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage

for (CChainState* chainstate : chainman.GetAll()) {
if (!is_coinsview_empty(chainstate)) {
if (chainman.m_blockman.m_have_pruned && 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);
}

const CBlockIndex* tip = chainstate->m_chain.Tip();
RPCNotifyBlockChange(tip);
if (tip && tip->nTime > GetTime() + MAX_FUTURE_BLOCK_TIME) {
Expand Down

0 comments on commit 94c0ceb

Please sign in to comment.