Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 2,387 Lines • ▼ Show 20 Lines | #endif | ||||
bool fLoaded = false; | bool fLoaded = false; | ||||
while (!fLoaded && !ShutdownRequested()) { | while (!fLoaded && !ShutdownRequested()) { | ||||
const bool fReset = fReindex; | const bool fReset = fReindex; | ||||
std::string strLoadError; | std::string strLoadError; | ||||
uiInterface.InitMessage(_("Loading block index...").translated); | uiInterface.InitMessage(_("Loading block index...").translated); | ||||
do { | do { | ||||
const int64_t load_block_index_start_time = GetTimeMillis(); | const int64_t load_block_index_start_time = GetTimeMillis(); | ||||
bool is_coinsview_empty; | |||||
try { | try { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
UnloadBlockIndex(); | UnloadBlockIndex(); | ||||
pcoinsTip.reset(); | pcoinsTip.reset(); | ||||
pcoinsdbview.reset(); | pcoinsdbview.reset(); | ||||
pcoinscatcher.reset(); | pcoinscatcher.reset(); | ||||
pblocktree.reset( | pblocktree.reset( | ||||
new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); | new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | while (!fLoaded && !ShutdownRequested()) { | ||||
"the database using -reindex-chainstate.") | "the database using -reindex-chainstate.") | ||||
.translated; | .translated; | ||||
break; | break; | ||||
} | } | ||||
// The on-disk coinsdb is now in a good state, create the cache | // The on-disk coinsdb is now in a good state, create the cache | ||||
pcoinsTip.reset(new CCoinsViewCache(pcoinscatcher.get())); | pcoinsTip.reset(new CCoinsViewCache(pcoinscatcher.get())); | ||||
bool is_coinsview_empty = fReset || fReindexChainState || | is_coinsview_empty = fReset || fReindexChainState || | ||||
pcoinsTip->GetBestBlock().IsNull(); | pcoinsTip->GetBestBlock().IsNull(); | ||||
if (!is_coinsview_empty) { | if (!is_coinsview_empty) { | ||||
// LoadChainTip sets ::ChainActive() based on pcoinsTip's | // LoadChainTip sets ::ChainActive() based on pcoinsTip's | ||||
// best block | // best block | ||||
if (!LoadChainTip(config)) { | if (!LoadChainTip(config)) { | ||||
strLoadError = | strLoadError = | ||||
_("Error initializing block database").translated; | _("Error initializing block database").translated; | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |