HomePhabricator

chain: add and set ASSUMED_VALID_FLAG for assumeutxo

Description

chain: add and set ASSUMED_VALID_FLAG for assumeutxo

Summary:

chain: add and set ASSUMED_VALID_FLAG for assumeutxo

Instead of (ab)using the existing BlockValidity flags to mark CBlockIndex entries which
we haven't yet fully validated (but assume validity for use with UTXO snapshot
loading), introduce a status flag that specifically marks an assumed-valid state.

This state is then removed in RaiseValidity() when the block has actually been
validated.

This distinction will allow us to make the necessary changes to various parts of the
system to facilitate assumeutxo/background chainstate validation but without leaking
details like snapshot height, as we had done previously.

validation: set ASSUMED_VALID_FLAG during snapshot load

Mark the block index entries that are beneath the snapshot base block as
assumed-valid. Subsequent commits will make use of this flag in other
parts of the system.

This is a backport of core#21526 [5 & 6/12]
https://github.com/bitcoin/bitcoin/pull/21526/commits/42b2520db93fd9feb3df4101654391fa7d3e2140
https://github.com/bitcoin/bitcoin/pull/21526/commits/01a9b8fe719efab2c268dc738bc93cfbdf92edb7

Depends on D12278

Test Plan: ninja all check-all bitcoin-fuzzers

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on Jul 21 2021, 17:31
PiRKCommitted on Oct 19 2022, 11:34
PiRKPushed on Oct 19 2022, 11:34
Reviewer
Restricted Project
Differential Revision
D12279: chain: add and set ASSUMED_VALID_FLAG for assumeutxo
Parents
rABCa1093fa5f579: validation: change UpdateTip for multiple chainstates
Branches
Unknown
Tags
Unknown