Page MenuHomePhabricator

D9757.diff
No OneTemporary

D9757.diff

diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -2563,7 +2563,7 @@
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
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp
--- a/src/qt/test/apptests.cpp
+++ b/src/qt/test/apptests.cpp
@@ -105,7 +105,7 @@
// 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
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -228,9 +228,9 @@
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.h b/src/validation.h
--- a/src/validation.h
+++ b/src/validation.h
@@ -225,7 +225,7 @@
/**
* Unload database information.
*/
-void UnloadBlockIndex();
+void UnloadBlockIndex(CTxMemPool *mempool);
/**
* Run an instance of the script checking thread.
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -5193,7 +5193,7 @@
// 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;
@@ -5202,7 +5202,9 @@
pindexBestForkTip = nullptr;
pindexBestForkBase = nullptr;
ResetASERTAnchorBlockCache();
- g_mempool.clear();
+ if (mempool) {
+ mempool->clear();
+ }
vinfoBlockFile.clear();
nLastBlockFile = 0;
setDirtyBlockIndex.clear();

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:21 (7 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187583
Default Alt Text
D9757.diff (2 KB)

Event Timeline