diff options
author | Martin Zumsande <mzumsande@gmail.com> | 2021-10-26 22:25:04 +0200 |
---|---|---|
committer | Martin Zumsande <mzumsande@gmail.com> | 2021-11-26 16:27:25 +0100 |
commit | 698c524698c33595a4d555eaa9e21bc19b4d3e93 (patch) | |
tree | 3e5ae26f60cfa4fd726856916a0db20a747f854f /src/index | |
parent | 111c3e06b35b7867f2e0f740e988f648ac6c325d (diff) | |
download | bitcoin-698c524698c33595a4d555eaa9e21bc19b4d3e93.tar.xz |
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.
Diffstat (limited to 'src/index')
-rw-r--r-- | src/index/base.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp index fc6dd77a72..8525dcbfa0 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -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; } } |