Skip to content

Commit

Permalink
partial bitcoin#23365: Fix backwards search for bestblock
Browse files Browse the repository at this point in the history
  • Loading branch information
mzumsande authored and kwvg committed Feb 26, 2022
1 parent 089800d commit 27bcd1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ bool BaseIndex::Init()
const CBlockIndex* block = ::ChainActive().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;
}
}
Expand Down

0 comments on commit 27bcd1b

Please sign in to comment.