Page MenuHomePhabricator

D8663.diff
No OneTemporary

D8663.diff

diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -229,10 +229,6 @@
LOCK2(::cs_main, ::g_cs_orphans);
node.connman->StopNodes();
}
- if (g_txindex) {
- g_txindex->Stop();
- }
- ForEachBlockFilterIndex([](BlockFilterIndex &index) { index.Stop(); });
StopTorControl();
@@ -252,8 +248,6 @@
g_avalanche.reset();
node.connman.reset();
node.banman.reset();
- g_txindex.reset();
- DestroyAllBlockFilterIndexes();
if (::g_mempool.IsLoaded() &&
node.args->GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
@@ -275,6 +269,14 @@
// generate CValidationInterface callbacks, flush them...
GetMainSignals().FlushBackgroundCallbacks();
+ // Stop and delete all indexes only after flushing background callbacks.
+ if (g_txindex) {
+ g_txindex->Stop();
+ g_txindex.reset();
+ }
+ ForEachBlockFilterIndex([](BlockFilterIndex &index) { index.Stop(); });
+ DestroyAllBlockFilterIndexes();
+
// Any future callbacks will be dropped. This should absolutely be safe - if
// missing a callback results in an unrecoverable situation, unclean
// shutdown would too. The only reason to do the above flushes is to let the

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:05 (19 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187494
Default Alt Text
D8663.diff (1 KB)

Event Timeline