HomePhabricator

refactor: simplify pruning violation check

Description

refactor: simplify pruning violation check

Summary:
By generalizing 'GetFirstStoredBlock' and implementing
'CheckBlockDataAvailability' we can dedup code and
avoid repeating work when multiple indexes are enabled.
E.g. get the oldest block across all indexes and
perform the pruning violation check from that point
up to the tip only once (this feature is being introduced
in a follow-up commit).

This commit shouldn't change behavior in any way.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>

This is a partial backport of core#27607 and core#25060 (for LIFETIMEBOUND)
https://github.com/bitcoin/bitcoin/pull/27607/commits/2ec89f1970935d27631bcd17b7923a79cdb1edbb

Depends on D17747

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17748

Details

Provenance
furszy <matiasfurszyfer@protonmail.com>Authored on May 16 2023, 22:19
PiRKCommitted on Tue, Mar 4, 14:37
PiRKPushed on Tue, Mar 4, 14:37
Reviewer
Restricted Project
Differential Revision
D17748: refactor: simplify pruning violation check
Parents
rABC8ec06eaff80b: make GetFirstStoredBlock assert that 'start_block' always has data
Branches
Unknown
Tags
Unknown