HomePhabricator

test: add reset_chainstate parameter for snapshot unittests

Description

test: add reset_chainstate parameter for snapshot unittests

Summary:

validation: add ResetChainstates()

Necessary for the following test commit.

https://github.com/bitcoin/bitcoin/pull/25667/commits/00b357c215ed900145bd770525a341ba0ed9c027

test: add reset_chainstate parameter for snapshot unittests

This CreateAndActivateUTXOSnapshot parameter is necessary once we
perform snapshot completion within ABC, since the existing UpdateTip
test will fail because the IBD chain that has generated the snapshot
will exceed the base of the snapshot.

Being able to test snapshots being loaded into a mostly-uninitialized
datadir allows for more realistic unittest scenarios.

https://github.com/bitcoin/bitcoin/pull/25667/commits/3c361391b8f5971eb3c7b620aa7ad9b437cc515e

Backport note: this process of resetting the chainstate without also resetting the block index would cause CheckBlockIndex to fail on assert(setBlockIndexCandidates.count(pindex))); after D4717 made CheckBlockIndex run on intermediate steps in ActiveBestChain. I disabled CheckBlockIndex until after the snapshot chain is activated.

This is a partial backport of core#25667
Depends on D14652

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on Jul 21 2022, 16:56
PiRKCommitted on Oct 26 2023, 11:32
PiRKPushed on Oct 26 2023, 11:32
Reviewer
Restricted Project
Differential Revision
D14653: test: add reset_chainstate parameter for snapshot unittests
Parents
rABC88394e92b4d6: move-only: test: make snapshot chainstate setup reusable
Branches
Unknown
Tags
Unknown