mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
validation: replace lock with annotation in UnloadBlockIndex()
This commit is contained in:
parent
6ac637f97f
commit
daad0093e3
3 changed files with 3 additions and 3 deletions
|
@ -180,7 +180,7 @@ ChainTestingSetup::~ChainTestingSetup()
|
||||||
m_node.banman.reset();
|
m_node.banman.reset();
|
||||||
m_node.addrman.reset();
|
m_node.addrman.reset();
|
||||||
m_node.args = nullptr;
|
m_node.args = nullptr;
|
||||||
UnloadBlockIndex(m_node.mempool.get(), *m_node.chainman);
|
WITH_LOCK(::cs_main, UnloadBlockIndex(m_node.mempool.get(), *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();
|
||||||
|
|
|
@ -4028,7 +4028,7 @@ void CChainState::UnloadBlockIndex() {
|
||||||
// block index state
|
// block index state
|
||||||
void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
|
void UnloadBlockIndex(CTxMemPool* mempool, ChainstateManager& chainman)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
AssertLockHeld(::cs_main);
|
||||||
chainman.Unload();
|
chainman.Unload();
|
||||||
pindexBestHeader = nullptr;
|
pindexBestHeader = nullptr;
|
||||||
if (mempool) mempool->clear();
|
if (mempool) mempool->clear();
|
||||||
|
|
|
@ -138,7 +138,7 @@ extern CBlockIndex *pindexBestHeader;
|
||||||
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);
|
void UnloadBlockIndex(CTxMemPool* mempool, 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…
Add table
Reference in a new issue