validation: add ResetChainstates()

Necessary for the following test commit.
This commit is contained in:
James O'Beirne
2022-07-21 12:56:47 -04:00
parent 3a29dfbfb2
commit 00b357c215
2 changed files with 9 additions and 0 deletions

View File

@@ -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);

View File

@@ -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)