|
92 | 92 | #include <llmq/options.h> |
93 | 93 | #include <llmq/signing.h> |
94 | 94 | #include <masternode/active/context.h> |
| 95 | +#include <masternode/active/notificationinterface.h> |
95 | 96 | #include <masternode/meta.h> |
96 | 97 | #include <masternode/node.h> |
97 | 98 | #include <masternode/sync.h> |
@@ -320,6 +321,11 @@ void PrepareShutdown(NodeContext& node) |
320 | 321 | // CValidationInterface callbacks, flush them... |
321 | 322 | GetMainSignals().FlushBackgroundCallbacks(); |
322 | 323 |
|
| 324 | + if (g_active_notification_interface) { |
| 325 | + UnregisterValidationInterface(g_active_notification_interface.get()); |
| 326 | + g_active_notification_interface.reset(); |
| 327 | + } |
| 328 | + |
323 | 329 | // After all scheduled tasks have been flushed, destroy pointers |
324 | 330 | // and reset all to nullptr. |
325 | 331 | node.active_ctx.reset(); |
@@ -376,10 +382,7 @@ void PrepareShutdown(NodeContext& node) |
376 | 382 | g_ds_notification_interface.reset(); |
377 | 383 | } |
378 | 384 |
|
379 | | - if (node.mn_activeman) { |
380 | | - UnregisterValidationInterface(node.mn_activeman.get()); |
381 | | - node.mn_activeman.reset(); |
382 | | - } |
| 385 | + node.mn_activeman.reset(); |
383 | 386 |
|
384 | 387 | node.chain_clients.clear(); |
385 | 388 |
|
@@ -1702,7 +1705,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) |
1702 | 1705 | } |
1703 | 1706 | // Create and register mn_activeman, will init later in ThreadImport |
1704 | 1707 | node.mn_activeman = std::make_unique<CActiveMasternodeManager>(keyOperator, *node.connman, node.dmnman); |
1705 | | - RegisterValidationInterface(node.mn_activeman.get()); |
1706 | 1708 | } |
1707 | 1709 |
|
1708 | 1710 | // Check port numbers |
@@ -2163,10 +2165,13 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) |
2163 | 2165 |
|
2164 | 2166 | // ********************************************************* Step 7d: Setup masternode mode |
2165 | 2167 | assert(!node.active_ctx); |
| 2168 | + assert(!g_active_notification_interface); |
2166 | 2169 | if (node.mn_activeman) { |
2167 | 2170 | node.active_ctx = std::make_unique<ActiveContext>(chainman, *node.connman, *node.dmnman, *node.cj_ctx->dstxman, *node.mn_metaman, |
2168 | 2171 | *node.llmq_ctx, *node.sporkman, *node.mempool, *node.peerman, *node.mn_activeman, |
2169 | 2172 | *node.mn_sync); |
| 2173 | + g_active_notification_interface = std::make_unique<ActiveNotificationInterface>(*node.mn_activeman); |
| 2174 | + RegisterValidationInterface(g_active_notification_interface.get()); |
2170 | 2175 | } |
2171 | 2176 |
|
2172 | 2177 | // ********************************************************* Step 7e: Setup other Dash services |
|
0 commit comments