Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 2,486 Lines • ▼ Show 20 Lines | while (!fLoaded && !ShutdownRequested()) { | ||||
if (!::ChainstateActive().CoinsDB().Upgrade()) { | if (!::ChainstateActive().CoinsDB().Upgrade()) { | ||||
strLoadError = | strLoadError = | ||||
_("Error upgrading chainstate database").translated; | _("Error upgrading chainstate database").translated; | ||||
break; | break; | ||||
} | } | ||||
// ReplayBlocks is a no-op if we cleared the coinsviewdb with | // ReplayBlocks is a no-op if we cleared the coinsviewdb with | ||||
// -reindex or -reindex-chainstate | // -reindex or -reindex-chainstate | ||||
if (!ReplayBlocks(params, &::ChainstateActive().CoinsDB())) { | if (!::ChainstateActive().ReplayBlocks(params)) { | ||||
strLoadError = | strLoadError = | ||||
_("Unable to replay blocks. You will need to rebuild " | _("Unable to replay blocks. You will need to rebuild " | ||||
"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 | ||||
::ChainstateActive().InitCoinsCache(); | ::ChainstateActive().InitCoinsCache(); | ||||
assert(::ChainstateActive().CanFlushToDisk()); | assert(::ChainstateActive().CanFlushToDisk()); | ||||
bool is_coinsview_empty = | bool is_coinsview_empty = | ||||
fReset || fReindexChainState || | fReset || fReindexChainState || | ||||
::ChainstateActive().CoinsTip().GetBestBlock().IsNull(); | ::ChainstateActive().CoinsTip().GetBestBlock().IsNull(); | ||||
if (!is_coinsview_empty) { | if (!is_coinsview_empty) { | ||||
// LoadChainTip sets ::ChainActive() based on CoinsTip()'s | // LoadChainTip initializes the chain based on CoinsTip()'s | ||||
// best block | // best block | ||||
if (!LoadChainTip(config)) { | if (!::ChainstateActive().LoadChainTip(chainparams)) { | ||||
strLoadError = | strLoadError = | ||||
_("Error initializing block database").translated; | _("Error initializing block database").translated; | ||||
break; | break; | ||||
} | } | ||||
assert(::ChainActive().Tip() != nullptr); | assert(::ChainActive().Tip() != nullptr); | ||||
uiInterface.InitMessage( | uiInterface.InitMessage( | ||||
_("Verifying blocks...").translated); | _("Verifying blocks...").translated); | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |