assumeutxo: remove snapshot during -reindex{-chainstate}

Removing a snapshot chainstate from disk (and memory) is consistent with
existing reindex operations.
This commit is contained in:
James O'Beirne
2023-05-03 15:39:51 -04:00
parent c93ef43e4f
commit c711ca186f
3 changed files with 39 additions and 9 deletions

View File

@@ -848,9 +848,6 @@ private:
//! Points to either the ibd or snapshot chainstate; indicates our
//! most-work chain.
//!
//! Once this pointer is set to a corresponding chainstate, it will not
//! be reset until init.cpp:Shutdown().
//!
//! This is especially important when, e.g., calling ActivateBestChain()
//! on all chainstates because we are not able to hold ::cs_main going into
//! that call.
@@ -1203,6 +1200,10 @@ public:
void ResetChainstates() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
//! Remove the snapshot-based chainstate and all on-disk artifacts.
//! Used when reindex{-chainstate} is called during snapshot use.
[[nodiscard]] bool DeleteSnapshotChainstate() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
//! Switch the active chainstate to one based on a UTXO snapshot that was loaded
//! previously.
Chainstate& ActivateExistingSnapshot(CTxMemPool* mempool, uint256 base_blockhash)