HomePhabricator

validation: assumeutxo: swap m_mempool on snapshot activation

Description

validation: assumeutxo: swap m_mempool on snapshot activation

Summary:

validation: assumeutxo: swap m_mempool on snapshot activation

Otherwise we will not receive transactions during background sync until restart.

https://github.com/bitcoin/bitcoin/pull/27596/commits/9511fb3616b7bbe1d0d2f54a45ea0a650ba0367b

And swap it back before deleting the snapshot chainstate:

init, validation: Fix -reindex option with an existing snapshot

This didn't work for two reasons:
1.) GetSnapshotCoinsDBPath() was used to retrieve the path.

This requires coins_views to exist, but the initialisation only happens later
(in CompleteChainstateInitialization) so the node hits an assert in
CCoinsViewDB& CoinsDB() and crashes.

2.) The snapshot was already activated, so it has the mempool attached.

Therefore, the mempool needs to be transferred back to the ibd
chainstate before deleting the snapshot chainstate.

https://github.com/bitcoin/bitcoin/pull/29726/commits/e57f951805b429534c75ec1e6b2a1f16ae24efb5

A functional test for core#29726 is added later, when we can test assumeutxo (requires loadtxoutset)

This is a partial backport of core#27596 and core#29726

Depends on D17896

Test Plan:
ninja all check-all (on my dev branch which has the functional test)

Run a full assumeutxo IBD (on my dev branch)

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
James O'Beirne <james.obeirne@pm.me>Authored on May 5 2023, 22:27
PiRKCommitted on Mon, Apr 7, 13:56
PiRKPushed on Mon, Apr 7, 13:56
Reviewer
Restricted Project
Differential Revision
D17897: validation: assumeutxo: swap m_mempool on snapshot activation
Parents
rABC5d870c3dab91: blockstorage: segment normal/assumedvalid blockfiles
Branches
Unknown
Tags
Unknown