Skip to content

Commit

Permalink
Move init logistics message for BAD_GENESIS_BLOCK to init.cpp
Browse files Browse the repository at this point in the history
Summary:
Partial backport of [[bitcoin/bitcoin#23280 | core#23280]]:
bitcoin/bitcoin@975235c

Depends on D12567.

Test Plan: Read the comment.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D12568
  • Loading branch information
dongcarl authored and Fabcien committed Nov 22, 2022
1 parent aa1cc47 commit 6df3904
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,9 @@ bool AppInitMain(Config &config, RPCServer &rpcServer,
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:
Expand Down
2 changes: 0 additions & 2 deletions src/node/chainstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ LoadChainstate(bool fReset, ChainstateManager &chainman, CTxMemPool *mempool,
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)) {
Expand Down

0 comments on commit 6df3904

Please sign in to comment.