File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -197,8 +197,6 @@ void Shutdown(NodeContext& node)
197
197
// using the other before destroying them.
198
198
if (node.peer_logic ) UnregisterValidationInterface (node.peer_logic .get ());
199
199
if (node.connman ) node.connman ->Stop ();
200
- if (g_txindex) g_txindex->Stop ();
201
- ForEachBlockFilterIndex ([](BlockFilterIndex& index) { index.Stop (); });
202
200
203
201
StopTorControl ();
204
202
@@ -212,8 +210,6 @@ void Shutdown(NodeContext& node)
212
210
node.peer_logic .reset ();
213
211
node.connman .reset ();
214
212
node.banman .reset ();
215
- g_txindex.reset ();
216
- DestroyAllBlockFilterIndexes ();
217
213
218
214
if (::mempool.IsLoaded () && gArgs .GetArg (" -persistmempool" , DEFAULT_PERSIST_MEMPOOL)) {
219
215
DumpMempool (::mempool);
@@ -246,6 +242,14 @@ void Shutdown(NodeContext& node)
246
242
// CValidationInterface callbacks, flush them...
247
243
GetMainSignals ().FlushBackgroundCallbacks ();
248
244
245
+ // Stop and delete all indexes only after flushing background callbacks.
246
+ if (g_txindex) {
247
+ g_txindex->Stop ();
248
+ g_txindex.reset ();
249
+ }
250
+ ForEachBlockFilterIndex ([](BlockFilterIndex& index) { index.Stop (); });
251
+ DestroyAllBlockFilterIndexes ();
252
+
249
253
// Any future callbacks will be dropped. This should absolutely be safe - if
250
254
// missing a callback results in an unrecoverable situation, unclean shutdown
251
255
// would too. The only reason to do the above flushes is to let the wallet catch
You can’t perform that action at this time.
0 commit comments