aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-07-19 20:30:18 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-07-29 12:29:51 +0200
commitfac674db200e6b2d5b32069335fb24e713d7b69f (patch)
treec34e2b54b07a899b5181cd69f846135051109b53 /src
parentfaec851b6eb7e65e28cdcae50d6dc86fafa0f91c (diff)
downloadbitcoin-fac674db200e6b2d5b32069335fb24e713d7b69f.tar.xz
Pass mempool pointer to UnloadBlockIndex
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp2
-rw-r--r--src/qt/test/apptests.cpp2
-rw-r--r--src/test/util/setup_common.cpp2
-rw-r--r--src/validation.cpp4
-rw-r--r--src/validation.h2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 1c89e2eeff..2bd1a5308c 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1566,7 +1566,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
chainman.m_total_coinstip_cache = nCoinCacheUsage;
chainman.m_total_coinsdb_cache = nCoinDBCache;
- UnloadBlockIndex();
+ UnloadBlockIndex(node.mempool);
// new CBlockTreeDB tries to delete the existing file, which
// fails if it's still open from the previous loop. Close it first:
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp
index 443e2d047d..b880a99baf 100644
--- a/src/qt/test/apptests.cpp
+++ b/src/qt/test/apptests.cpp
@@ -83,7 +83,7 @@ void AppTests::appTests()
// Reset global state to avoid interfering with later tests.
LogInstance().DisconnectTestLogger();
AbortShutdown();
- UnloadBlockIndex();
+ UnloadBlockIndex(/* mempool */ nullptr);
WITH_LOCK(::cs_main, g_chainman.Reset());
}
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index 0cd991f453..14f65dcb7c 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -182,9 +182,9 @@ TestingSetup::~TestingSetup()
m_node.connman.reset();
m_node.banman.reset();
m_node.args = nullptr;
+ UnloadBlockIndex(m_node.mempool);
m_node.mempool = nullptr;
m_node.scheduler.reset();
- UnloadBlockIndex();
m_node.chainman->Reset();
m_node.chainman = nullptr;
pblocktree.reset();
diff --git a/src/validation.cpp b/src/validation.cpp
index 545aa0f2d3..462d8d961b 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -4587,13 +4587,13 @@ 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()
+void UnloadBlockIndex(CTxMemPool* mempool)
{
LOCK(cs_main);
g_chainman.Unload();
pindexBestInvalid = nullptr;
pindexBestHeader = nullptr;
- mempool.clear();
+ if (mempool) mempool->clear();
vinfoBlockFile.clear();
nLastBlockFile = 0;
setDirtyBlockIndex.clear();
diff --git a/src/validation.h b/src/validation.h
index 53503768aa..c76edd142a 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -160,7 +160,7 @@ void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
/** Ensures we have a genesis block in the block tree, possibly writing one to disk. */
bool LoadGenesisBlock(const CChainParams& chainparams);
/** Unload database information */
-void UnloadBlockIndex();
+void UnloadBlockIndex(CTxMemPool* mempool);
/** Run an instance of the script checking thread */
void ThreadScriptCheck(int worker_num);
/**