mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-28 18:01:27 +02:00
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:
parent
572d831927
commit
7d99d725cd
@ -256,7 +256,7 @@ epilogue:
|
|||||||
}
|
}
|
||||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||||
|
|
||||||
WITH_LOCK(::cs_main, UnloadBlockIndex(nullptr, chainman));
|
WITH_LOCK(::cs_main, UnloadBlockIndex(chainman));
|
||||||
|
|
||||||
init::UnsetGlobals();
|
init::UnsetGlobals();
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ ChainTestingSetup::~ChainTestingSetup()
|
|||||||
m_node.addrman.reset();
|
m_node.addrman.reset();
|
||||||
m_node.netgroupman.reset();
|
m_node.netgroupman.reset();
|
||||||
m_node.args = nullptr;
|
m_node.args = nullptr;
|
||||||
WITH_LOCK(::cs_main, UnloadBlockIndex(m_node.mempool.get(), *m_node.chainman));
|
WITH_LOCK(::cs_main, UnloadBlockIndex(*m_node.chainman));
|
||||||
m_node.mempool.reset();
|
m_node.mempool.reset();
|
||||||
m_node.scheduler.reset();
|
m_node.scheduler.reset();
|
||||||
m_node.chainman.reset();
|
m_node.chainman.reset();
|
||||||
|
@ -4146,11 +4146,10 @@ void CChainState::UnloadBlockIndex()
|
|||||||
// May NOT be used after any connections are up as much
|
// May NOT be used after any connections are up as much
|
||||||
// of the peer-processing logic assumes a consistent
|
// of the peer-processing logic assumes a consistent
|
||||||
// block index state
|
// block index state
|
||||||
void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
|
void UnloadBlockIndex(ChainstateManager& chainman)
|
||||||
{
|
{
|
||||||
AssertLockHeld(::cs_main);
|
AssertLockHeld(::cs_main);
|
||||||
chainman.Unload();
|
chainman.Unload();
|
||||||
if (mempool) mempool->clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChainstateManager::LoadBlockIndex()
|
bool ChainstateManager::LoadBlockIndex()
|
||||||
@ -5231,7 +5230,7 @@ void ChainstateManager::MaybeRebalanceCaches()
|
|||||||
ChainstateManager::~ChainstateManager()
|
ChainstateManager::~ChainstateManager()
|
||||||
{
|
{
|
||||||
LOCK(::cs_main);
|
LOCK(::cs_main);
|
||||||
UnloadBlockIndex(/*mempool=*/nullptr, *this);
|
UnloadBlockIndex(*this);
|
||||||
|
|
||||||
// TODO: The version bits cache and warning cache should probably become
|
// TODO: The version bits cache and warning cache should probably become
|
||||||
// non-globals
|
// non-globals
|
||||||
|
@ -135,7 +135,7 @@ extern arith_uint256 nMinimumChainWork;
|
|||||||
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
||||||
|
|
||||||
/** Unload database information */
|
/** Unload database information */
|
||||||
void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
void UnloadBlockIndex(ChainstateManager& chainman) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||||
/** Run instances of script checking worker threads */
|
/** Run instances of script checking worker threads */
|
||||||
void StartScriptCheckWorkerThreads(int threads_num);
|
void StartScriptCheckWorkerThreads(int threads_num);
|
||||||
/** Stop all of the script checking worker threads */
|
/** Stop all of the script checking worker threads */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user