mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
Automatically reorganize at startup to best known block
Given that the block tree database (chain.dat) and the active chain database (coins.dat) are entirely separate now, it becomes legal to swap one with another instance without affecting the other. This commit introduces a check in the startup code that detects the presence of a better chain in chain.dat that has not been activated yet, and does so efficiently (in batch, while reusing the blk???.dat files).
This commit is contained in:
@@ -636,7 +636,6 @@ bool LoadBlockIndex(CChainDB &chaindb)
|
||||
{
|
||||
if (pindexGenesisBlock == NULL)
|
||||
return true;
|
||||
return error("CTxDB::LoadBlockIndex() : hashBestChain not loaded");
|
||||
}
|
||||
hashBestChain = pindexBest->GetBlockHash();
|
||||
nBestHeight = pindexBest->nHeight;
|
||||
|
||||
Reference in New Issue
Block a user