Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/active/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ActiveContext::ActiveContext(CBLSWorker& bls_worker, ChainstateManager& chainman
const CMasternodeSync& mn_sync, const CBLSSecretKey& operator_sk,
const llmq::QvvecSyncModeMap& sync_map, const util::DbWrapperParams& db_params,
bool quorums_recovery, bool quorums_watch) :
m_isman{isman},
m_qman{qman},
nodeman{std::make_unique<CActiveMasternodeManager>(connman, dmnman, operator_sk)},
dkgdbgman{std::make_unique<llmq::CDKGDebugManager>()},
Expand All @@ -53,14 +52,12 @@ ActiveContext::ActiveContext(CBLSWorker& bls_worker, ChainstateManager& chainman
qblockman, qsnapman, *nodeman, chainman, sporkman,
llmq_params, quorums_watch, quorum_idx);
});
m_isman.ConnectSigner(is_signer.get());
m_qman.ConnectManagers(qman_handler.get(), qdkgsman.get());
}

ActiveContext::~ActiveContext()
{
m_qman.DisconnectManagers();
m_isman.DisconnectSigner();
}

void ActiveContext::Start(CConnman& connman, PeerManager& peerman)
Expand Down
3 changes: 2 additions & 1 deletion src/active/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ struct DbWrapperParams;

struct ActiveContext final : public CValidationInterface {
private:
llmq::CInstantSendManager& m_isman;
llmq::CQuorumManager& m_qman;

public:
Expand Down Expand Up @@ -97,6 +96,8 @@ struct ActiveContext final : public CValidationInterface {
const std::unique_ptr<llmq::CEHFSignalsHandler> ehf_sighandler;
const std::unique_ptr<llmq::QuorumParticipant> qman_handler;
const std::unique_ptr<chainlock::ChainLockSigner> cl_signer;

public:
const std::unique_ptr<instantsend::InstantSendSigner> is_signer;

/** Owned by PeerManager, use GetCJServer() */
Expand Down
34 changes: 7 additions & 27 deletions src/dsnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,25 @@

#include <dsnotificationinterface.h>

#include <util/check.h>
#include <validation.h>

#include <coinjoin/coinjoin.h>
#include <evo/deterministicmns.h>
#include <evo/mnauth.h>
#include <governance/governance.h>
#include <instantsend/instantsend.h>
#include <llmq/context.h>
#include <llmq/dkgsessionmgr.h>
#include <llmq/ehf_signals.h>
#include <llmq/quorumsman.h>
#include <masternode/sync.h>
#include <util/check.h>
#include <validation.h>

CDSNotificationInterface::CDSNotificationInterface(CConnman& connman,
CDSTXManager& dstxman,
CMasternodeSync& mn_sync,
CGovernanceManager& govman,
const ChainstateManager& chainman,
const std::unique_ptr<CDeterministicMNManager>& dmnman,
const std::unique_ptr<LLMQContext>& llmq_ctx) :

CDSNotificationInterface::CDSNotificationInterface(CConnman& connman, CDSTXManager& dstxman, CMasternodeSync& mn_sync,
CGovernanceManager& govman, const ChainstateManager& chainman,
const std::unique_ptr<CDeterministicMNManager>& dmnman) :
m_connman{connman},
m_dstxman{dstxman},
m_mn_sync{mn_sync},
m_govman{govman},
m_chainman{chainman},
m_dmnman{dmnman},
m_llmq_ctx{llmq_ctx}
m_dmnman{dmnman}
{
}

Expand Down Expand Up @@ -76,7 +67,6 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
m_dstxman.UpdatedBlockTip(pindexNew);
}

m_llmq_ctx->isman->UpdatedBlockTip(pindexNew);
if (m_govman.IsValid()) {
m_govman.UpdatedBlockTip(pindexNew);
}
Expand All @@ -85,25 +75,16 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef& ptx, int64_t nAcceptTime,
uint64_t mempool_sequence)
{
Assert(m_llmq_ctx)->isman->TransactionAddedToMempool(ptx);
m_dstxman.TransactionAddedToMempool(ptx);
}

void CDSNotificationInterface::TransactionRemovedFromMempool(const CTransactionRef& ptx, MemPoolRemovalReason reason,
uint64_t mempool_sequence)
{
Assert(m_llmq_ctx)->isman->TransactionRemovedFromMempool(ptx);
}

void CDSNotificationInterface::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
{
Assert(m_llmq_ctx)->isman->BlockConnected(pblock, pindex);
m_dstxman.BlockConnected(pblock, pindex);
}

void CDSNotificationInterface::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected)
{
Assert(m_llmq_ctx)->isman->BlockDisconnected(pblock, pindexDisconnected);
m_dstxman.BlockDisconnected(pblock, pindexDisconnected);
}

Expand All @@ -118,7 +99,6 @@ void CDSNotificationInterface::NotifyMasternodeListChanged(bool undo, const CDet
void CDSNotificationInterface::NotifyChainLock(const CBlockIndex* pindex,
const std::shared_ptr<const chainlock::ChainLockSig>& clsig)
{
Assert(m_llmq_ctx)->isman->NotifyChainLock(pindex);
if (m_mn_sync.IsBlockchainSynced()) {
m_dstxman.NotifyChainLock(pindex);
}
Expand Down
14 changes: 3 additions & 11 deletions src/dsnotificationinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,16 @@ class CDeterministicMNManager;
class CGovernanceManager;
class ChainstateManager;
class CMasternodeSync;
struct LLMQContext;

class CDSNotificationInterface : public CValidationInterface
{
public:
CDSNotificationInterface() = delete;
CDSNotificationInterface(const CDSNotificationInterface&) = delete;
CDSNotificationInterface& operator=(const CDSNotificationInterface&) = delete;
explicit CDSNotificationInterface(CConnman& connman,
CDSTXManager& dstxman,
CMasternodeSync& mn_sync,
CGovernanceManager& govman,
const ChainstateManager& chainman,
const std::unique_ptr<CDeterministicMNManager>& dmnman,
const std::unique_ptr<LLMQContext>& llmq_ctx);
explicit CDSNotificationInterface(CConnman& connman, CDSTXManager& dstxman, CMasternodeSync& mn_sync,
CGovernanceManager& govman, const ChainstateManager& chainman,
const std::unique_ptr<CDeterministicMNManager>& dmnman);
virtual ~CDSNotificationInterface();

// a small helper to initialize current block height in sub-modules on startup
Expand All @@ -40,8 +35,6 @@ class CDSNotificationInterface : public CValidationInterface
void SynchronousUpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
void TransactionAddedToMempool(const CTransactionRef& tx, int64_t nAcceptTime, uint64_t mempool_sequence) override;
void TransactionRemovedFromMempool(const CTransactionRef& ptx, MemPoolRemovalReason reason,
uint64_t mempool_sequence) override;
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex) override;
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected) override;
void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff) override;
Expand All @@ -54,7 +47,6 @@ class CDSNotificationInterface : public CValidationInterface
CGovernanceManager& m_govman;
const ChainstateManager& m_chainman;
const std::unique_ptr<CDeterministicMNManager>& m_dmnman;
const std::unique_ptr<LLMQContext>& m_llmq_ctx;
};

extern std::unique_ptr<CDSNotificationInterface> g_ds_notification_interface;
Expand Down
5 changes: 3 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
#include <instantsend/net_instantsend.h>
#include <llmq/context.h>
#include <llmq/dkgsessionmgr.h>
#include <llmq/signing.h>
#include <llmq/net_signing.h>
#include <llmq/options.h>
#include <llmq/observer/context.h>
Expand Down Expand Up @@ -2175,7 +2176,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
RegisterValidationInterface(node.peerman.get());

g_ds_notification_interface = std::make_unique<CDSNotificationInterface>(
*node.connman, *node.dstxman, *node.mn_sync, *node.govman, chainman, node.dmnman, node.llmq_ctx
*node.connman, *node.dstxman, *node.mn_sync, *node.govman, chainman, node.dmnman // todo: replace unique_ptr for dmnman to reference
);
RegisterValidationInterface(g_ds_notification_interface.get());

Expand Down Expand Up @@ -2207,7 +2208,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)

// ********************************************************* Step 7d: Setup other Dash services

node.peerman->AddExtraHandler(std::make_unique<NetInstantSend>(node.peerman.get(), *node.llmq_ctx->isman, *node.llmq_ctx->qman, chainman.ActiveChainstate()));
node.peerman->AddExtraHandler(std::make_unique<NetInstantSend>(node.peerman.get(), *node.llmq_ctx->isman, node.active_ctx ? node.active_ctx->is_signer.get() : nullptr, *node.llmq_ctx->sigman, *node.llmq_ctx->qman, *node.chainlocks, chainman.ActiveChainstate(), *node.mempool, *node.mn_sync));
node.peerman->AddExtraHandler(std::make_unique<llmq::NetSigning>(node.peerman.get(), *node.llmq_ctx->sigman, node.active_ctx ? node.active_ctx->shareman.get() : nullptr, *node.sporkman));

if (node.active_ctx) {
Expand Down
Loading
Loading