Page MenuHomePhabricator

refactor: simplify pruning violation check
ClosedPublic

Authored by PiRK on Tue, Mar 4, 10:12.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC8b333e573585: 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