diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2021-04-18 16:48:52 +0200 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2022-04-25 23:18:01 +0200 |
commit | 231fc7b035481f748159968353c1cab81354e843 (patch) | |
tree | 4b04c9911342bd54b070a567c9eda6dec9a1efc0 /src/index | |
parent | 1e7db37e76c510d373c4404eea2b97508b367aca (diff) | |
download | bitcoin-231fc7b035481f748159968353c1cab81354e843.tar.xz |
refactor: Introduce GetFirstStoredBlock helper function
Diffstat (limited to 'src/index')
-rw-r--r-- | src/index/base.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp index 8fe30f8960..9f60d331c6 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -75,11 +75,7 @@ bool BaseIndex::Init() if (!m_best_block_index) { // index is not built yet // make sure we have all block data back to the genesis - const CBlockIndex* block = active_chain.Tip(); - while (block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) { - block = block->pprev; - } - prune_violation = block != active_chain.Genesis(); + prune_violation = node::GetFirstStoredBlock(active_chain.Tip()) != active_chain.Genesis(); } // in case the index has a best block set and is not fully synced // check if we have the required blocks to continue building the index |