validation: Remove needs_init from LoadBlockIndex

It does not control any actual logic and the log message as well as the
comment are obsolete, since no database initialization takes place there
anymore. Log messages indicating when indexes and chainstate databases
are loaded exist in other places.
This commit is contained in:
TheCharlatan 2024-05-17 18:35:45 +02:00
parent 533eab7d67
commit e172553223
No known key found for this signature in database
GPG Key ID: 9B79B45691DB4173

View File

@ -4790,7 +4790,6 @@ bool ChainstateManager::LoadBlockIndex()
{
AssertLockHeld(cs_main);
// Load block index from databases
bool needs_init = m_blockman.m_reindexing;
if (!m_blockman.m_reindexing) {
bool ret{m_blockman.LoadBlockIndexDB(SnapshotBlockhash())};
if (!ret) return false;
@ -4822,18 +4821,6 @@ bool ChainstateManager::LoadBlockIndex()
if (pindex->IsValid(BLOCK_VALID_TREE) && (m_best_header == nullptr || CBlockIndexWorkComparator()(m_best_header, pindex)))
m_best_header = pindex;
}
needs_init = m_blockman.m_block_index.empty();
}
if (needs_init) {
// Everything here is for *new* reindex/DBs. Thus, though
// LoadBlockIndexDB may have set m_reindexing if we shut down
// mid-reindex previously, we don't check m_reindexing and
// instead only check it prior to LoadBlockIndexDB to set
// needs_init.
LogPrintf("Initializing databases...\n");
}
return true;
}