aboutsummaryrefslogtreecommitdiff
path: root/src/node/interfaces.cpp
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2024-01-18 20:23:48 +0100
committerTheCharlatan <seb.kung@gmail.com>2024-02-15 14:37:01 +0100
commit84f5c135b8118cbe15b8bfb4db80d61237987f64 (patch)
tree582c81822878c575620436e51f53739eb558ae3e /src/node/interfaces.cpp
parent473dd4b97ae40e43e1a1a97fdbeb40be4855e9bc (diff)
refactor: De-globalize g_signals
Diffstat (limited to 'src/node/interfaces.cpp')
-rw-r--r--src/node/interfaces.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 5a8b7fc105..1814834f35 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -460,19 +460,20 @@ public:
class NotificationsHandlerImpl : public Handler
{
public:
- explicit NotificationsHandlerImpl(std::shared_ptr<Chain::Notifications> notifications)
- : m_proxy(std::make_shared<NotificationsProxy>(std::move(notifications)))
+ explicit NotificationsHandlerImpl(CMainSignals& signals, std::shared_ptr<Chain::Notifications> notifications)
+ : m_signals{signals}, m_proxy{std::make_shared<NotificationsProxy>(std::move(notifications))}
{
- RegisterSharedValidationInterface(m_proxy);
+ m_signals.RegisterSharedValidationInterface(m_proxy);
}
~NotificationsHandlerImpl() override { disconnect(); }
void disconnect() override
{
if (m_proxy) {
- UnregisterSharedValidationInterface(m_proxy);
+ m_signals.UnregisterSharedValidationInterface(m_proxy);
m_proxy.reset();
}
}
+ CMainSignals& m_signals;
std::shared_ptr<NotificationsProxy> m_proxy;
};
@@ -761,12 +762,12 @@ public:
}
std::unique_ptr<Handler> handleNotifications(std::shared_ptr<Notifications> notifications) override
{
- return std::make_unique<NotificationsHandlerImpl>(std::move(notifications));
+ return std::make_unique<NotificationsHandlerImpl>(validation_signals(), std::move(notifications));
}
void waitForNotificationsIfTipChanged(const uint256& old_tip) override
{
if (!old_tip.IsNull() && old_tip == WITH_LOCK(::cs_main, return chainman().ActiveChain().Tip()->GetBlockHash())) return;
- SyncWithValidationInterfaceQueue();
+ validation_signals().SyncWithValidationInterfaceQueue();
}
std::unique_ptr<Handler> handleRpc(const CRPCCommand& command) override
{
@@ -822,6 +823,7 @@ public:
NodeContext* context() override { return &m_node; }
ArgsManager& args() { return *Assert(m_node.args); }
ChainstateManager& chainman() { return *Assert(m_node.chainman); }
+ CMainSignals& validation_signals() { return *Assert(m_node.validation_signals); }
NodeContext& m_node;
};
} // namespace