File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -227,12 +227,8 @@ void Interrupt(NodeContext& node)
227227 InterruptMapPort ();
228228 if (node.connman )
229229 node.connman ->Interrupt ();
230- if (g_txindex) {
231- g_txindex->Interrupt ();
232- }
233- ForEachBlockFilterIndex ([](BlockFilterIndex& index) { index.Interrupt (); });
234- if (g_coin_stats_index) {
235- g_coin_stats_index->Interrupt ();
230+ for (auto * index : node.indexes ) {
231+ index->Interrupt ();
236232 }
237233}
238234
@@ -303,16 +299,11 @@ void Shutdown(NodeContext& node)
303299 GetMainSignals ().FlushBackgroundCallbacks ();
304300
305301 // Stop and delete all indexes only after flushing background callbacks.
306- if (g_txindex) {
307- g_txindex->Stop ();
308- g_txindex.reset ();
309- }
310- if (g_coin_stats_index) {
311- g_coin_stats_index->Stop ();
312- g_coin_stats_index.reset ();
313- }
314- ForEachBlockFilterIndex ([](BlockFilterIndex& index) { index.Stop (); });
302+ for (auto * index : node.indexes ) index->Stop ();
303+ if (g_txindex) g_txindex.reset ();
304+ if (g_coin_stats_index) g_coin_stats_index.reset ();
315305 DestroyAllBlockFilterIndexes ();
306+ node.indexes .clear (); // all instances are nullptr now
316307
317308 // Any future callbacks will be dropped. This should absolutely be safe - if
318309 // missing a callback results in an unrecoverable situation, unclean shutdown
You can’t perform that action at this time.
0 commit comments