Merge bitcoin/bitcoin#35673: refactor: Move LoadGenesisBlock to ChainstateManager

fa615bd163 refactor: Move LoadGenesisBlock to ChainstateManager (MarcoFalke)

Pull request description:

  The function does not need anything from any chainstate, so it should not sit in the Chainstate class.

ACKs for top commit:
  l0rinc:
    Tested ACK fa615bd163
  janb84:
    reACK fa615bd163
  sedited:
    ACK fa615bd163

Tree-SHA512: 482b5c140faa35944a890c941fd185a896a3c04fec46d0cc6dd56830f62ee8fe5200fd13d25f7a80a5da0eb4fb42717f42c8bce837d933668432f5786f8380e3
This commit is contained in:
merge-script
2026-07-08 10:07:44 +02:00
6 changed files with 17 additions and 16 deletions

View File

@@ -1305,7 +1305,7 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
chainman.m_blockman.m_blockfiles_indexed = true;
LogInfo("Reindexing finished");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
chainman.ActiveChainstate().LoadGenesisBlock();
(void)chainman.LoadGenesisBlock();
}
// -loadblock=

View File

@@ -62,7 +62,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
// If we're not mid-reindex (based on disk + args), add a genesis block on disk
// (otherwise we use the one already on disk).
// This is called again in ImportBlocks after the reindex completes.
if (chainman.m_blockman.m_blockfiles_indexed && !chainman.ActiveChainstate().LoadGenesisBlock()) {
if (chainman.m_blockman.m_blockfiles_indexed && !chainman.LoadGenesisBlock()) {
return {ChainstateLoadStatus::FAILURE, _("Error initializing block database")};
}