Merge b1ba1b178f into merged_master (Bitcoin PR bitcoin/bitcoin#30132)

This commit is contained in:
Tom Trevethan 2026-02-26 07:10:28 +00:00
commit af7931ef34
12 changed files with 73 additions and 62 deletions

View file

@ -644,7 +644,7 @@ bool BlockManager::LoadBlockIndexDB(ChainstateManager& chainman, const std::opti
// Check whether we need to continue reindexing
bool fReindexing = false;
m_block_tree_db->ReadReindexing(fReindexing);
if (fReindexing) m_reindexing = true;
if (fReindexing) m_blockfiles_indexed = false;
return true;
}
@ -1277,7 +1277,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
ImportingNow imp{chainman.m_blockman.m_importing};
// -reindex
if (chainman.m_blockman.m_reindexing) {
if (!chainman.m_blockman.m_blockfiles_indexed) {
int nFile = 0;
// Map of disk positions for blocks with unknown parent (only used for reindex);
// parent hash -> child disk position, multiple children can have the same parent.
@ -1300,7 +1300,7 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
nFile++;
}
WITH_LOCK(::cs_main, chainman.m_blockman.m_block_tree_db->WriteReindexing(false));
chainman.m_blockman.m_reindexing = false;
chainman.m_blockman.m_blockfiles_indexed = true;
LogPrintf("Reindexing finished\n");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
chainman.ActiveChainstate().LoadGenesisBlock();