validation: No mempool clearing in UnloadBlockIndex

The only caller that uses this is ~ChainTestingSetup() where we
immediately destroy the mempool afterwards.
This commit is contained in:
Carl Dong
2022-01-11 15:11:56 -05:00
parent 572d831927
commit 7d99d725cd
4 changed files with 5 additions and 6 deletions

View File

@@ -4146,11 +4146,10 @@ void CChainState::UnloadBlockIndex()
// May NOT be used after any connections are up as much
// of the peer-processing logic assumes a consistent
// block index state
void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
void UnloadBlockIndex(ChainstateManager& chainman)
{
AssertLockHeld(::cs_main);
chainman.Unload();
if (mempool) mempool->clear();
}
bool ChainstateManager::LoadBlockIndex()
@@ -5231,7 +5230,7 @@ void ChainstateManager::MaybeRebalanceCaches()
ChainstateManager::~ChainstateManager()
{
LOCK(::cs_main);
UnloadBlockIndex(/*mempool=*/nullptr, *this);
UnloadBlockIndex(*this);
// TODO: The version bits cache and warning cache should probably become
// non-globals