aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 2175f73d70..aaa7d43203 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -866,6 +866,11 @@ bool AppInit2(boost::thread_group& threadGroup)
break;
}
+ // 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() && pindexGenesisBlock == NULL)
+ 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)
if (!InitBlockIndex()) {
strLoadError = _("Error initializing block database");