diff options
author | Matt Corallo <git@bluematt.me> | 2017-07-06 20:00:11 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-07-27 15:03:05 -0400 |
commit | b0f32497b873cd1eaf0be86f8e265355aa86174f (patch) | |
tree | 4f9c82cd3d5f51e5236254cdc874279391e75034 /src/init.cpp | |
parent | eda888e57352037ab2e60f6ef90098b3ce23a157 (diff) | |
download | bitcoin-b0f32497b873cd1eaf0be86f8e265355aa86174f.tar.xz |
More user-friendly error message if UTXO DB runs ahead of block DB
This gives LoadChainTip a return value - allowing it to indicate that
the UTXO DB ran ahead of the block DB. This just provides a nicer
error message instead of the previous mysterious
assert(!setBlockIndexCandidates.empty()) error.
This also calls ActivateBestChain in case we just loaded the genesis
block in LoadChainTip, avoiding relying on the ActivateBestChain
in ThreadImport before continuing init process.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index b1fe8e7d3c..8fec69c2b8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1442,7 +1442,15 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) break; } pcoinsTip = new CCoinsViewCache(pcoinscatcher); - LoadChainTip(chainparams); + + if (!fReindex && !fReindexChainState) { + // LoadChainTip sets chainActive based on pcoinsTip's best block + if (!LoadChainTip(chainparams)) { + strLoadError = _("Error initializing block database"); + break; + } + assert(chainActive.Tip() != NULL); + } if (!fReindex && chainActive.Tip() != NULL) { uiInterface.InitMessage(_("Rewinding blocks...")); |