Merge pull request #2642 from sipa/rightgenesis

Check for correct genesis
This commit is contained in:
Jeff Garzik 2013-05-30 08:04:02 -07:00
commit 3fad76bf83
1 changed files with 5 additions and 0 deletions

View File

@ -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");