mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-05-17 23:56:39 +00:00
Move -checkblocks LogPrintf to AppInitMain
This commit is contained in:
parent
aad8d59789
commit
8d466a8504
@ -1477,11 +1477,16 @@ 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.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
|
||||||
|
if (fHavePruned && 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,
|
||||||
fReset,
|
fReset,
|
||||||
fReindexChainState,
|
fReindexChainState,
|
||||||
chainparams,
|
chainparams,
|
||||||
args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
|
check_blocks,
|
||||||
args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
|
args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
LogPrintf("%s\n", e.what());
|
LogPrintf("%s\n", e.what());
|
||||||
|
@ -143,11 +143,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 (fHavePruned && 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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user