mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: make pdsNotificationInterface
a unique_ptr
, rename
This commit is contained in:
parent
17110f50b3
commit
dacf859218
@ -153,3 +153,5 @@ void CDSNotificationInterface::NotifyChainLock(const CBlockIndex* pindex, const
|
|||||||
m_llmq_ctx->isman->NotifyChainLock(pindex);
|
m_llmq_ctx->isman->NotifyChainLock(pindex);
|
||||||
m_cj_ctx->dstxman->NotifyChainLock(pindex, *m_llmq_ctx->clhandler, m_mn_sync);
|
m_cj_ctx->dstxman->NotifyChainLock(pindex, *m_llmq_ctx->clhandler, m_mn_sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;
|
||||||
|
@ -60,4 +60,6 @@ private:
|
|||||||
const std::unique_ptr<CJContext>& m_cj_ctx;
|
const std::unique_ptr<CJContext>& m_cj_ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;
|
||||||
|
|
||||||
#endif // BITCOIN_DSNOTIFICATIONINTERFACE_H
|
#endif // BITCOIN_DSNOTIFICATIONINTERFACE_H
|
||||||
|
16
src/init.cpp
16
src/init.cpp
@ -141,8 +141,6 @@ static constexpr bool DEFAULT_PROXYRANDOMIZE{true};
|
|||||||
static constexpr bool DEFAULT_REST_ENABLE{false};
|
static constexpr bool DEFAULT_REST_ENABLE{false};
|
||||||
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};
|
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};
|
||||||
|
|
||||||
static CDSNotificationInterface* pdsNotificationInterface = nullptr;
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
|
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
|
||||||
// accessing block files don't count towards the fd_set size limit
|
// accessing block files don't count towards the fd_set size limit
|
||||||
@ -369,11 +367,11 @@ void PrepareShutdown(NodeContext& node)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pdsNotificationInterface) {
|
if (g_ds_notification_interface) {
|
||||||
UnregisterValidationInterface(pdsNotificationInterface);
|
UnregisterValidationInterface(g_ds_notification_interface.get());
|
||||||
delete pdsNotificationInterface;
|
g_ds_notification_interface.reset();
|
||||||
pdsNotificationInterface = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.mn_activeman) {
|
if (node.mn_activeman) {
|
||||||
UnregisterValidationInterface(node.mn_activeman.get());
|
UnregisterValidationInterface(node.mn_activeman.get());
|
||||||
node.mn_activeman.reset();
|
node.mn_activeman.reset();
|
||||||
@ -2147,10 +2145,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
node.cj_ctx, node.llmq_ctx, ignores_incoming_txs);
|
node.cj_ctx, node.llmq_ctx, ignores_incoming_txs);
|
||||||
RegisterValidationInterface(node.peerman.get());
|
RegisterValidationInterface(node.peerman.get());
|
||||||
|
|
||||||
pdsNotificationInterface = new CDSNotificationInterface(
|
g_ds_notification_interface = std::make_unique<CDSNotificationInterface>(
|
||||||
*node.connman, *node.mn_sync, *node.govman, *node.peerman, chainman, node.mn_activeman.get(), node.dmnman, node.llmq_ctx, node.cj_ctx
|
*node.connman, *node.mn_sync, *node.govman, *node.peerman, chainman, node.mn_activeman.get(), node.dmnman, node.llmq_ctx, node.cj_ctx
|
||||||
);
|
);
|
||||||
RegisterValidationInterface(pdsNotificationInterface);
|
RegisterValidationInterface(g_ds_notification_interface.get());
|
||||||
|
|
||||||
// ********************************************************* Step 7c: Setup CoinJoin
|
// ********************************************************* Step 7c: Setup CoinJoin
|
||||||
|
|
||||||
@ -2327,7 +2325,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &args, &chainman, &node] {
|
chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &args, &chainman, &node] {
|
||||||
ThreadImport(chainman, *node.dmnman, *pdsNotificationInterface, vImportFiles, node.mn_activeman.get(), args);
|
ThreadImport(chainman, *node.dmnman, *g_ds_notification_interface, vImportFiles, node.mn_activeman.get(), args);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for genesis block to be processed
|
// Wait for genesis block to be processed
|
||||||
|
Loading…
Reference in New Issue
Block a user