diff options
author | James O'Beirne <james.obeirne@pm.me> | 2022-07-21 12:56:47 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@pm.me> | 2022-09-13 13:30:28 -0400 |
commit | 00b357c215ed900145bd770525a341ba0ed9c027 (patch) | |
tree | 209fcde588b0c1d29370f5c8ddca01b9ab7cc101 /src | |
parent | 3a29dfbfb2c16a50d854f6f81428a68aa9180509 (diff) |
validation: add ResetChainstates()
Necessary for the following test commit.
Diffstat (limited to 'src')
-rw-r--r-- | src/validation.cpp | 7 | ||||
-rw-r--r-- | src/validation.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index b94950d1b4..f46ee1145e 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5165,6 +5165,13 @@ void ChainstateManager::MaybeRebalanceCaches() } } +void ChainstateManager::ResetChainstates() +{ + m_ibd_chainstate.reset(); + m_snapshot_chainstate.reset(); + m_active_chainstate = nullptr; +} + ChainstateManager::~ChainstateManager() { LOCK(::cs_main); diff --git a/src/validation.h b/src/validation.h index 8a977f21c2..d95841f3e1 100644 --- a/src/validation.h +++ b/src/validation.h @@ -1051,6 +1051,8 @@ public: //! snapshot that is in the process of being validated. bool DetectSnapshotChainstate(CTxMemPool* mempool) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); + void ResetChainstates() 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) |