HomePhabricator

Move block-storage-related logic to ChainstateManager

Description

Move block-storage-related logic to ChainstateManager

Summary:
Separate the notion of which blocks are stored on disk, and what data is in our
block index, from what tip a chainstate might be able to get to. We can use
chainstate-agnostic data to determine when to store a block on disk (primarily,
an anti-DoS set of criteria) and let the chainstates figure out for themselves
when a block is of interest for being a candidate tip.

Note: some of the invariants in CheckBlockIndex are modified, but more work is
needed (ie to move CheckBlockIndex to ChainstateManager, as most of what
CheckBlockIndex is doing is checking the consistency of the block index, which
is outside of Chainstate).

This is a partial backport of core#27746
https://github.com/bitcoin/bitcoin/pull/27746/commits/d0d40ea9a6478d81d7531b7cfc52a8bdaa0883d6

Depends on D17532

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
Suhas Daftuar <sdaftuar@chaincode.com>Authored on Jun 6 2023, 12:24
PiRKCommitted on Fri, Jan 17, 08:07
PiRKPushed on Fri, Jan 17, 08:07
Reviewer
Restricted Project
Differential Revision
D17533: Move block-storage-related logic to ChainstateManager
Parents
rABCe476633f2c51: Add wrapper for adding entries to a chainstate's block index candidates
Branches
Unknown
Tags
Unknown