HomePhabricator

validation: add ChainMan logic for completing UTXO snapshot validation

Description

validation: add ChainMan logic for completing UTXO snapshot validation

Summary:

add ChainstateManager.GetSnapshot{BaseHeight,BaseBlock}()

For use in later commits.

https://github.com/bitcoin/bitcoin/pull/25740/commits/5ee22cdafd2562bcb8bf0ae6025e4b53c826382d


add Chainstate::HasCoinsViews()

Used in subsequent commits. Also cleans up asserts in
coins_views-related convenience methods to be more exact.

https://github.com/bitcoin/bitcoin/pull/25740/commits/637a90b973f60555ea4fef4b845ffa7533dcb866


validation: add ChainMan logic for completing UTXO snapshot validation

Trigger completion when a background validation chainstate reaches the
same height as a UTXO snapshot, and handle cleaning up the chainstate
on subsequent startup.

https://github.com/bitcoin/bitcoin/pull/25740/commits/d96c59cc5cd2f73f1f55c133c52208671fe75ef3


log: add LoadBlockIndex() message for assumedvalid blocks

I found this useful during unittest debugging.

https://github.com/bitcoin/bitcoin/pull/25740/commits/7300ced9de22e6d1bff816e6538d3370cebe7501


refactor: make MempoolMutex() public

for use in the following unittests.

https://github.com/bitcoin/bitcoin/pull/25740/commits/d70919a88fc90a2662f9a844deb085d03ee7b5d8


test: add snapshot completion unittests

Also adjusts the previous snapshot chainstate init tests
to account for the fact that the init process is now attempting to
validate and complete background chainstates whose tip is at the
snapshot base block. We use a DisconnectTip() hack to preserve the
nature of the test.

https://github.com/bitcoin/bitcoin/pull/25740/commits/87a1108c81fe0cb15c3860e3a67dc1f43ffec705


This completes backport of core#25740

Depends on D14686

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on Oct 28 2021, 20:59
PiRKCommitted on Oct 26 2023, 11:39
PiRKPushed on Oct 26 2023, 11:39
Reviewer
Restricted Project
Differential Revision
D14687: validation: add ChainMan logic for completing UTXO snapshot validation
Parents
rABC004abc8d7eee: move-only-ish: init: factor out chainstate initialization
Branches
Unknown
Tags
Unknown