refactor: Move LoadGenesisBlock to ChainstateManager

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

Also, mark it [[nodiscard]], and the one place that ignores the return
value with (void).

Also, change the error log strings to not include the __func__, which is
redundant with -logsourcelocations. This is not a refactor, but this log
is only for debugging extremely rare errors.
This commit is contained in:
MarcoFalke
2026-07-06 16:34:10 +02:00
parent 69fc991791
commit fa615bd163
6 changed files with 17 additions and 16 deletions

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