aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-10-10 13:13:47 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2014-10-14 15:42:01 -0700
commitafc32c5eeada01b141706e32f0405bdb86c00f04 (patch)
tree5916cc76e2170cd23e9c87f73e9e576326581741 /src/init.cpp
parent16d5194165c8c83492b95f431a664d98c40ff254 (diff)
downloadbitcoin-afc32c5eeada01b141706e32f0405bdb86c00f04.tar.xz
Fix rebuild-chainstate feature and improve its performance
Previous refactorings broke the ability to rebuild the chainstate by deleting the chainstate directory, resulting in an incorrect "Incorrect or no genesis block found" error message. Fix that. Also, improve the performance of ActivateBestBlockStep by using the skiplist to only discover a few potential blocks to connect at a time, instead of all blocks forever - as we likely bail out after connecting a single one anyway.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 8772be5539..55991ac9b3 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -974,7 +974,7 @@ bool AppInit2(boost::thread_group& threadGroup)
// If the loaded chain has a wrong genesis, bail out immediately
// (we're likely using a testnet datadir, or the other way around).
- if (!mapBlockIndex.empty() && chainActive.Genesis() == NULL)
+ if (!mapBlockIndex.empty() && mapBlockIndex.count(Params().HashGenesisBlock()) == 0)
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
// Initialize the block index (no-op if non-empty database was already loaded)