HomePhabricator

validation: don't modify genesis during snapshot load

Description

validation: don't modify genesis during snapshot load

Summary:
Avoid modifying the genesis block index entry during snapshot load. This
is because, in a future change that fixes LoadBlockIndex for UTXO
snapshots, we detect block index entries that are reliant on
assumed-valid ancestors and treat them specially.

Since the genesis block doesn't have BLOCK_VALID_SCRIPTS, it would be
erroneously marked BLOCK_ASSUMED_VALID during snapshot load if we didn't
skip it here. This would cause a "setBlockIndexCandidates() empty"
assertion to be tripped since all block index entries would be marked
assume-valid due to genesis, which is never re-validated.

There's probably no good reason to modify the genesis block index entry
during snapshot load anyway...

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

Depends on D12301

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on Oct 28 2021, 19:15
PiRKCommitted on Oct 19 2022, 11:34
PiRKPushed on Oct 19 2022, 11:34
Reviewer
Restricted Project
Differential Revision
D12303: validation: don't modify genesis during snapshot load
Parents
rABC1a5b38c7ea78: doc: Various validation doc fixups
Branches
Unknown
Tags
Unknown