mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Split off VerifyLoadedChainstate
This commit is contained in:
38
src/init.cpp
38
src/init.cpp
@@ -1427,9 +1427,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
fReindexChainState,
|
||||
nBlockTreeDBCache,
|
||||
nCoinDBCache,
|
||||
nCoinCacheUsage,
|
||||
args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
|
||||
args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
|
||||
nCoinCacheUsage);
|
||||
if (rv.has_value()) {
|
||||
switch (rv.value()) {
|
||||
case ChainstateLoadingError::ERROR_LOADING_BLOCK_DB:
|
||||
@@ -1461,20 +1459,34 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
strLoadError = strprintf(_("Witness data for blocks after height %d requires validation. Please restart with -reindex."),
|
||||
chainparams.GetConsensus().SegwitHeight);
|
||||
break;
|
||||
case ChainstateLoadingError::ERROR_BLOCK_FROM_FUTURE:
|
||||
strLoadError = _("The block database contains a block which appears to be from the future. "
|
||||
"This may be due to your computer's date and time being set incorrectly. "
|
||||
"Only rebuild the block database if you are sure that your computer's date and time are correct");
|
||||
break;
|
||||
case ChainstateLoadingError::ERROR_CORRUPTED_BLOCK_DB:
|
||||
strLoadError = _("Corrupted block database detected");
|
||||
break;
|
||||
case ChainstateLoadingError::SHUTDOWN_PROBED:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fLoaded = true;
|
||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - load_block_index_start_time);
|
||||
auto rv2 = VerifyLoadedChainstate(chainman,
|
||||
fReset,
|
||||
fReindexChainState,
|
||||
chainparams,
|
||||
args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
|
||||
args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
|
||||
if (rv2.has_value()) {
|
||||
switch (rv2.value()) {
|
||||
case ChainstateLoadVerifyError::ERROR_BLOCK_FROM_FUTURE:
|
||||
strLoadError = _("The block database contains a block which appears to be from the future. "
|
||||
"This may be due to your computer's date and time being set incorrectly. "
|
||||
"Only rebuild the block database if you are sure that your computer's date and time are correct");
|
||||
break;
|
||||
case ChainstateLoadVerifyError::ERROR_CORRUPTED_BLOCK_DB:
|
||||
strLoadError = _("Corrupted block database detected");
|
||||
break;
|
||||
case ChainstateLoadVerifyError::ERROR_GENERIC_FAILURE:
|
||||
strLoadError = _("Error opening block database");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fLoaded = true;
|
||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - load_block_index_start_time);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fLoaded && !ShutdownRequested()) {
|
||||
|
||||
Reference in New Issue
Block a user