mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
index: Fix backwards search for bestblock
This allows filters to be reconstructed when the best known block is the Genesis block without needing to reindex. It fixes Init errors seen in #23289.
This commit is contained in:
parent
111c3e06b3
commit
698c524698
1 changed files with 2 additions and 1 deletions
|
@ -91,11 +91,12 @@ bool BaseIndex::Init()
|
|||
const CBlockIndex* block = active_chain.Tip();
|
||||
prune_violation = true;
|
||||
// check backwards from the tip if we have all block data until we reach the indexes bestblock
|
||||
while (block_to_test && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) {
|
||||
while (block_to_test && block && (block->nStatus & BLOCK_HAVE_DATA)) {
|
||||
if (block_to_test == block) {
|
||||
prune_violation = false;
|
||||
break;
|
||||
}
|
||||
assert(block->pprev);
|
||||
block = block->pprev;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue