Move -checkblocks LogPrintf to AppInitMain

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-03 12:32:20 +00:00
parent d3345eeccc
commit 94c0ceb29c
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 6 additions and 6 deletions

View File

@ -1960,12 +1960,17 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
std::optional<ChainstateLoadVerifyError> rv2; std::optional<ChainstateLoadVerifyError> rv2;
try { try {
uiInterface.InitMessage(_("Verifying blocks…").translated); 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, rv2 = VerifyLoadedChainstate(chainman,
*Assert(node.evodb.get()), *Assert(node.evodb.get()),
fReset, fReset,
fReindexChainState, fReindexChainState,
chainparams, chainparams,
args.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS), check_blocks,
args.GetArg("-checklevel", DEFAULT_CHECKLEVEL)); args.GetArg("-checklevel", DEFAULT_CHECKLEVEL));
} catch (const std::exception& e) { } catch (const std::exception& e) {
LogPrintf("%s\n", e.what()); LogPrintf("%s\n", e.what());

View File

@ -245,11 +245,6 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
for (CChainState* chainstate : chainman.GetAll()) { for (CChainState* chainstate : chainman.GetAll()) {
if (!is_coinsview_empty(chainstate)) { 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(); const CBlockIndex* tip = chainstate->m_chain.Tip();
RPCNotifyBlockChange(tip); RPCNotifyBlockChange(tip);
if (tip && tip->nTime > GetTime() + MAX_FUTURE_BLOCK_TIME) { if (tip && tip->nTime > GetTime() + MAX_FUTURE_BLOCK_TIME) {