HomePhabricator

validation: have LoadBlockIndex account for snapshot use

Description

validation: have LoadBlockIndex account for snapshot use

Summary:

validation: insert assumed-valid block index entries into candidates

https://github.com/bitcoin/bitcoin/pull/21526/commits/5a807736dacfc3e6fa57231219336acf08be38fb


validation: have LoadBlockIndex account for snapshot use

Ensure that blocks past the snapshot base block (i.e. the end of the
assumed-valid region of the chain) are not included in
setBlockIndexCandidates for the background validation chainstate. These
blocks, while fully validated and lacking the BLOCK_ASSUMED_VALID flag,
*rely* on blocks which are assumed-valid, and so shouldn't be added to
the IBD chainstate.

Co-authored-by: Russ Yanofsky <russ@yanofsky.org>

https://github.com/bitcoin/bitcoin/pull/23174/commits/0fd599a51a700c028d6f7ed8067d2d9f6e6a04a5


test: add tests for LoadBlockIndex when using multiple chainstates

Incorporates feedback from Russ Yanofsky.

https://github.com/bitcoin/bitcoin/pull/23174/commits/2283b9cd1ee0fbd1e8ebc61673b1fe7596199a24


This is a partial backport of core#21526 and core#23174

Notes:

  • See D6308 for CBlockIndex::UpdateChainStats().
  • See D8319 for why I have to upgrade the block dabase in setup_common.cpp to make the test work.

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on Oct 28 2021, 20:07
PiRKCommitted on Oct 24 2022, 12:58
PiRKPushed on Oct 24 2022, 12:58
Reviewer
Restricted Project
Differential Revision
D12280: validation: have LoadBlockIndex account for snapshot use
Parents
rABCafbc199feaa2: addrman: Log too low compat value
Branches
Unknown
Tags
Unknown