Skip to content

Commit fac674d

Browse files
author
MarcoFalke
committed
Pass mempool pointer to UnloadBlockIndex
1 parent faec851 commit fac674d

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
15661566
chainman.m_total_coinstip_cache = nCoinCacheUsage;
15671567
chainman.m_total_coinsdb_cache = nCoinDBCache;
15681568

1569-
UnloadBlockIndex();
1569+
UnloadBlockIndex(node.mempool);
15701570

15711571
// new CBlockTreeDB tries to delete the existing file, which
15721572
// fails if it's still open from the previous loop. Close it first:

src/qt/test/apptests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void AppTests::appTests()
8383
// Reset global state to avoid interfering with later tests.
8484
LogInstance().DisconnectTestLogger();
8585
AbortShutdown();
86-
UnloadBlockIndex();
86+
UnloadBlockIndex(/* mempool */ nullptr);
8787
WITH_LOCK(::cs_main, g_chainman.Reset());
8888
}
8989

src/test/util/setup_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ TestingSetup::~TestingSetup()
182182
m_node.connman.reset();
183183
m_node.banman.reset();
184184
m_node.args = nullptr;
185+
UnloadBlockIndex(m_node.mempool);
185186
m_node.mempool = nullptr;
186187
m_node.scheduler.reset();
187-
UnloadBlockIndex();
188188
m_node.chainman->Reset();
189189
m_node.chainman = nullptr;
190190
pblocktree.reset();

src/validation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,13 +4587,13 @@ void CChainState::UnloadBlockIndex() {
45874587
// May NOT be used after any connections are up as much
45884588
// of the peer-processing logic assumes a consistent
45894589
// block index state
4590-
void UnloadBlockIndex()
4590+
void UnloadBlockIndex(CTxMemPool* mempool)
45914591
{
45924592
LOCK(cs_main);
45934593
g_chainman.Unload();
45944594
pindexBestInvalid = nullptr;
45954595
pindexBestHeader = nullptr;
4596-
mempool.clear();
4596+
if (mempool) mempool->clear();
45974597
vinfoBlockFile.clear();
45984598
nLastBlockFile = 0;
45994599
setDirtyBlockIndex.clear();

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
160160
/** Ensures we have a genesis block in the block tree, possibly writing one to disk. */
161161
bool LoadGenesisBlock(const CChainParams& chainparams);
162162
/** Unload database information */
163-
void UnloadBlockIndex();
163+
void UnloadBlockIndex(CTxMemPool* mempool);
164164
/** Run an instance of the script checking thread */
165165
void ThreadScriptCheck(int worker_num);
166166
/**

0 commit comments

Comments
 (0)