Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,945 Lines • ▼ Show 20 Lines | #endif | ||||
LogPrintf("* Using %.1fMiB for chain state database\n", | LogPrintf("* Using %.1fMiB for chain state database\n", | ||||
nCoinDBCache * (1.0 / 1024 / 1024)); | nCoinDBCache * (1.0 / 1024 / 1024)); | ||||
LogPrintf("* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of " | LogPrintf("* Using %.1fMiB for in-memory UTXO set (plus up to %.1fMiB of " | ||||
"unused mempool space)\n", | "unused mempool space)\n", | ||||
nCoinCacheUsage * (1.0 / 1024 / 1024), | nCoinCacheUsage * (1.0 / 1024 / 1024), | ||||
nMempoolSizeMax * (1.0 / 1024 / 1024)); | nMempoolSizeMax * (1.0 / 1024 / 1024)); | ||||
bool fLoaded = false; | bool fLoaded = false; | ||||
while (!fLoaded) { | while (!fLoaded && !fRequestShutdown) { | ||||
bool fReset = fReindex; | bool fReset = fReindex; | ||||
std::string strLoadError; | std::string strLoadError; | ||||
uiInterface.InitMessage(_("Loading block index...")); | uiInterface.InitMessage(_("Loading block index...")); | ||||
nStart = GetTimeMillis(); | nStart = GetTimeMillis(); | ||||
do { | do { | ||||
try { | try { | ||||
Show All 16 Lines | while (!fLoaded && !fRequestShutdown) { | ||||
// block files and all undo data files | // block files and all undo data files | ||||
if (fPruneMode) { | if (fPruneMode) { | ||||
CleanupBlockRevFiles(); | CleanupBlockRevFiles(); | ||||
} | } | ||||
} else if (!pcoinsdbview->Upgrade()) { | } else if (!pcoinsdbview->Upgrade()) { | ||||
strLoadError = _("Error upgrading chainstate database"); | strLoadError = _("Error upgrading chainstate database"); | ||||
break; | break; | ||||
} | } | ||||
if (fRequestShutdown) break; | |||||
if (!LoadBlockIndex(chainparams)) { | if (!LoadBlockIndex(chainparams)) { | ||||
strLoadError = _("Error loading block database"); | strLoadError = _("Error loading block database"); | ||||
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 | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | while (!fLoaded && !fRequestShutdown) { | ||||
LogPrintf("%s\n", e.what()); | LogPrintf("%s\n", e.what()); | ||||
strLoadError = _("Error opening block database"); | strLoadError = _("Error opening block database"); | ||||
break; | break; | ||||
} | } | ||||
fLoaded = true; | fLoaded = true; | ||||
} while (false); | } while (false); | ||||
if (!fLoaded) { | if (!fLoaded && !fRequestShutdown) { | ||||
// first suggest a reindex | // first suggest a reindex | ||||
if (!fReset) { | if (!fReset) { | ||||
bool fRet = uiInterface.ThreadSafeQuestion( | bool fRet = uiInterface.ThreadSafeQuestion( | ||||
strLoadError + ".\n\n" + | strLoadError + ".\n\n" + | ||||
_("Do you want to rebuild the block database now?"), | _("Do you want to rebuild the block database now?"), | ||||
strLoadError + ".\nPlease restart with -reindex or " | strLoadError + ".\nPlease restart with -reindex or " | ||||
"-reindex-chainstate to recover.", | "-reindex-chainstate to recover.", | ||||
"", | "", | ||||
▲ Show 20 Lines • Show All 145 Lines • Show Last 20 Lines |