From 975235ca0a8f5bcf9df880698b3b0d4bbde9f7fb Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Thu, 11 Nov 2021 16:20:44 -0500 Subject: [PATCH] Move init logistics message for BAD_GENESIS_BLOCK to init.cpp --- src/init.cpp | 2 ++ src/node/chainstate.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 6ed382a00c..0db5464fbc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1436,6 +1436,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) strLoadError = _("Error loading block database"); break; 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?")); case ChainstateLoadingError::ERROR_PRUNED_NEEDS_REINDEX: strLoadError = _("You need to rebuild the database using -reindex to go back to unpruned mode. This will redownload the entire blockchain"); diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index b8914a0c65..86de364ca7 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -61,8 +61,6 @@ std::optional LoadChainstate(bool fReset, return ChainstateLoadingError::ERROR_LOADING_BLOCK_DB; } - // 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() && !chainman.m_blockman.LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) { return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK;