Move init logistics message for BAD_GENESIS_BLOCK to init.cpp

This commit is contained in:
Kittywhiskers Van Gogh 2021-11-11 16:20:44 -05:00
parent 29c736280d
commit 2ea1bbc7aa
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 2 additions and 2 deletions

View File

@ -1901,6 +1901,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
strLoadError = _("Error loading block database"); strLoadError = _("Error loading block database");
break; break;
case ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK: case ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK:
// If the loaded chain has a wrong genesis, bail out immediately
// (we're likely using a testnet datadir, or the other way around).
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?")); return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
case ChainstateLoadingError::ERROR_BAD_DEVNET_GENESIS_BLOCK: case ChainstateLoadingError::ERROR_BAD_DEVNET_GENESIS_BLOCK:
return InitError(_("Incorrect or no devnet genesis block found. Wrong datadir for devnet specified?")); return InitError(_("Incorrect or no devnet genesis block found. Wrong datadir for devnet specified?"));

View File

@ -128,8 +128,6 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
return ChainstateLoadingError::ERROR_TXINDEX_DISABLED_WHEN_GOV_ENABLED; return ChainstateLoadingError::ERROR_TXINDEX_DISABLED_WHEN_GOV_ENABLED;
} }
// If the loaded chain has a wrong genesis, bail out immediately
// (we're likely using a testnet datadir, or the other way around).
if (!chainman.BlockIndex().empty() && if (!chainman.BlockIndex().empty() &&
!chainman.m_blockman.LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) { !chainman.m_blockman.LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) {
return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK; return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK;