Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 792 Lines • ▼ Show 20 Lines | gArgs.AddArg( | ||||
"and level 4 tries to reconnect the blocks. " | "and level 4 tries to reconnect the blocks. " | ||||
"Each level includes the checks of the previous levels " | "Each level includes the checks of the previous levels " | ||||
"(0-4, default: %u)", | "(0-4, default: %u)", | ||||
DEFAULT_CHECKLEVEL), | DEFAULT_CHECKLEVEL), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::DEBUG_TEST); | OptionsCategory::DEBUG_TEST); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-checkblockindex", | "-checkblockindex", | ||||
strprintf("Do a full consistency check for mapBlockIndex, " | strprintf("Do a full consistency check for the block tree, " | ||||
"setBlockIndexCandidates, ::ChainActive() and " | "setBlockIndexCandidates, ::ChainActive() and " | ||||
"mapBlocksUnlinked occasionally. (default: %u, regtest: %u)", | "mapBlocksUnlinked occasionally. (default: %u, regtest: %u)", | ||||
defaultChainParams->DefaultConsistencyChecks(), | defaultChainParams->DefaultConsistencyChecks(), | ||||
regtestChainParams->DefaultConsistencyChecks()), | regtestChainParams->DefaultConsistencyChecks()), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::DEBUG_TEST); | OptionsCategory::DEBUG_TEST); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-checkmempool=<n>", | "-checkmempool=<n>", | ||||
▲ Show 20 Lines • Show All 1,629 Lines • ▼ Show 20 Lines | while (!fLoaded && !ShutdownRequested()) { | ||||
} | } | ||||
strLoadError = _("Error loading block database").translated; | strLoadError = _("Error loading block database").translated; | ||||
break; | break; | ||||
} | } | ||||
// If the loaded chain has a wrong genesis, bail out immediately | // If the loaded chain has a wrong genesis, bail out immediately | ||||
// (we're likely using a testnet datadir, or the other way | // (we're likely using a testnet datadir, or the other way | ||||
// around). | // around). | ||||
if (!mapBlockIndex.empty() && | if (!::BlockIndex().empty() && | ||||
!LookupBlockIndex(params.hashGenesisBlock)) { | !LookupBlockIndex(params.hashGenesisBlock)) { | ||||
return InitError(_("Incorrect or no genesis block found. " | return InitError(_("Incorrect or no genesis block found. " | ||||
"Wrong datadir for network?") | "Wrong datadir for network?") | ||||
.translated); | .translated); | ||||
} | } | ||||
// Check for changed -prune state. What we are concerned about | // Check for changed -prune state. What we are concerned about | ||||
// is a user who has pruned blocks in the past, but is now | // is a user who has pruned blocks in the past, but is now | ||||
Show All 15 Lines | while (!fLoaded && !ShutdownRequested()) { | ||||
// completes. | // completes. | ||||
if (!fReindex && !LoadGenesisBlock(chainparams)) { | if (!fReindex && !LoadGenesisBlock(chainparams)) { | ||||
strLoadError = | strLoadError = | ||||
_("Error initializing block database").translated; | _("Error initializing block database").translated; | ||||
break; | break; | ||||
} | } | ||||
// At this point we're either in reindex or we've loaded a | // At this point we're either in reindex or we've loaded a | ||||
// useful block tree into mapBlockIndex! | // useful block tree into BlockIndex()! | ||||
pcoinsdbview.reset(new CCoinsViewDB( | pcoinsdbview.reset(new CCoinsViewDB( | ||||
nCoinDBCache, false, fReset || fReindexChainState)); | nCoinDBCache, false, fReset || fReindexChainState)); | ||||
pcoinscatcher.reset( | pcoinscatcher.reset( | ||||
new CCoinsViewErrorCatcher(pcoinsdbview.get())); | new CCoinsViewErrorCatcher(pcoinsdbview.get())); | ||||
pcoinscatcher->AddReadErrCallback([]() { | pcoinscatcher->AddReadErrCallback([]() { | ||||
uiInterface.ThreadSafeMessageBox( | uiInterface.ThreadSafeMessageBox( | ||||
_("Error reading from database, shutting down.") | _("Error reading from database, shutting down.") | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | #endif | ||||
// Step 12: start node | // Step 12: start node | ||||
int chain_active_height; | int chain_active_height; | ||||
//// debug print | //// debug print | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size()); | LogPrintf("block tree size = %u\n", ::BlockIndex().size()); | ||||
chain_active_height = ::ChainActive().Height(); | chain_active_height = ::ChainActive().Height(); | ||||
} | } | ||||
LogPrintf("nBestHeight = %d\n", chain_active_height); | LogPrintf("nBestHeight = %d\n", chain_active_height); | ||||
if (gArgs.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) { | if (gArgs.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) { | ||||
StartTorControl(); | StartTorControl(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |