Skip to content

Commit 00b357c

Browse files
committed
validation: add ResetChainstates()
Necessary for the following test commit.
1 parent 3a29dfb commit 00b357c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/validation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5165,6 +5165,13 @@ void ChainstateManager::MaybeRebalanceCaches()
51655165
}
51665166
}
51675167

5168+
void ChainstateManager::ResetChainstates()
5169+
{
5170+
m_ibd_chainstate.reset();
5171+
m_snapshot_chainstate.reset();
5172+
m_active_chainstate = nullptr;
5173+
}
5174+
51685175
ChainstateManager::~ChainstateManager()
51695176
{
51705177
LOCK(::cs_main);

src/validation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,8 @@ class ChainstateManager
10511051
//! snapshot that is in the process of being validated.
10521052
bool DetectSnapshotChainstate(CTxMemPool* mempool) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
10531053

1054+
void ResetChainstates() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
1055+
10541056
//! Switch the active chainstate to one based on a UTXO snapshot that was loaded
10551057
//! previously.
10561058
Chainstate& ActivateExistingSnapshot(CTxMemPool* mempool, uint256 base_blockhash)

0 commit comments

Comments
 (0)