aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-07-26 14:41:50 -0400
committerMatt Corallo <git@bluematt.me>2017-08-01 16:35:02 -0400
commit13ab353829bfcf928a0dd88cc9841e6515eea111 (patch)
tree326f61f279b5470e48648ee7275bd103f65f159f /src/init.cpp
parentfce3f4f4920714187616e76fdecbec306e8d7a8f (diff)
downloadbitcoin-13ab353829bfcf928a0dd88cc9841e6515eea111.tar.xz
Check for empty coinsview instead of just-reset coinsview in init
This fixes a few cases where we should be treating a restart-after- coinsviewdb-reset identically to a just-reset-coinsviewdb. Thanks to @morcos for identifying the bug.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5cc45c52fa..ae84e49cd8 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1469,7 +1469,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
// The on-disk coinsdb is now in a good state, create the cache
pcoinsTip = new CCoinsViewCache(pcoinscatcher);
- if (!fReset && !fReindexChainState) {
+ bool is_coinsview_empty = fReset || fReindexChainState || pcoinsTip->GetBestBlock().IsNull();
+ if (!is_coinsview_empty) {
// LoadChainTip sets chainActive based on pcoinsTip's best block
if (!LoadChainTip(chainparams)) {
strLoadError = _("Error initializing block database");
@@ -1489,7 +1490,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
- if (!fReset && !fReindexChainState) {
+ if (!is_coinsview_empty) {
uiInterface.InitMessage(_("Verifying blocks..."));
if (fHavePruned && GetArg("-checkblocks", DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks",