mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-13 16:20:20 +02:00
refactor: Deduplicate Chainstate activation code
Move duplicate code from ChainstateManager::ActivateSnapshot and
ChainstateManager::ActivateExistingSnapshot methods to a new
ChainstateManager::AddChainstate method.
The "AddChainstate" method name doesn't mention snapshots even though it is
only used to add snapshot chainstates now, because it becomes more generalized
in a later commit in this PR ("refactor: Add ChainstateManager::m_chainstates
member")
This commit is contained in:
@@ -1315,16 +1315,15 @@ public:
|
||||
//! snapshot that is in the process of being validated.
|
||||
bool DetectSnapshotChainstate() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
//! Add new chainstate.
|
||||
Chainstate& AddChainstate(std::unique_ptr<Chainstate> chainstate) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
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(uint256 base_blockhash) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
//! If we have validated a snapshot chain during this runtime, copy its
|
||||
//! chainstate directory over to the main `chainstate` location, completing
|
||||
//! validation of the snapshot.
|
||||
|
||||
Reference in New Issue
Block a user