Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2c23869
refactor: move ProcessInstantSendLock to NetInstantSend
knst Jan 28, 2026
a469587
refactor: simplify ProcessInstantSendLock by using PeerManager on pla…
knst Jan 28, 2026
654ba8a
refactor: move usages of mempool from CInstantSendManager to NetInsta…
knst Jan 29, 2026
7785d7c
refactor: drop dependency of mempool from instantsend/instantsend
knst Jan 29, 2026
5937d78
refactor: move all notification handlers from CInstantSendManager to …
knst Jan 29, 2026
32916a4
refactor: move ResolveBlockConflicts to NetInstantSend
knst Feb 12, 2026
2a06aec
refactor: use only cached height of tip, don't retrieve it directly ever
knst Feb 12, 2026
9c0e03f
refactor: remove dependency of CInstantSendManager on chainstate
knst Feb 12, 2026
8d0a772
refactor: remove dependency of CInstantSendManager on signer
knst Feb 12, 2026
9c84ed3
refactor: re-order clean-up calls for confirmed block for instant-sen…
knst Feb 12, 2026
1e88ac3
refactor: drop helper interface InstantSendSignerParent
knst Feb 12, 2026
843716a
refactor: move usages sigman directly to NetInstantSend
knst Feb 12, 2026
f506a00
refactor: drop dependency of CInstantSendManager on llmq::CSigningMan…
knst Feb 12, 2026
17db40f
refactor: drop dependency of CInstantSendManager on chainlocks
knst Feb 25, 2026
2f47b9e
refactor: removed unused includes
knst Feb 25, 2026
0c6db64
refactor: review fixes for CInstantSendManager decoupling
UdjinM6 Feb 27, 2026
770819e
fix: code review comment by pastaclaw
knst Mar 20, 2026
a98d36c
fix: set cached tip for isman without validationinterface
knst Mar 24, 2026
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>(dmnman, qsnapman, chainman)},
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, int16_t worker_count)
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
10 changes: 8 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 @@ -2176,7 +2177,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 @@ -2208,7 +2209,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 Expand Up @@ -2418,6 +2419,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// GetMainSignals().UpdatedBlockTip(::ChainActive().Tip());
g_ds_notification_interface->InitializeCurrentBlockTip();

// Seed InstantSend tip-height cache; NetInstantSend receives future
// updates via CValidationInterface but misses InitializeCurrentBlockTip.
// TODO: move cache updates from NetInstantSend to g_ds_notification due to specific of Tip's processing
node.llmq_ctx->isman->CacheTipHeight(chainman.ActiveChain().Tip());

{
// Get all UTXOs for each MN collateral in one go so that we can fill coin cache early
// and reduce further locking overhead for cs_main in other parts of code including GUI
Expand Down
Loading
Loading