Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/coinjoin/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ bool CCoinJoinServer::AlreadyHave(const CInv& inv)
return (inv.type == MSG_DSQ) ? m_queueman.HasQueue(inv.hash) : false;
}

bool CCoinJoinServer::ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker)
bool CCoinJoinServer::ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker)
{
if (inv.type != MSG_DSQ) return false;

Expand Down
2 changes: 1 addition & 1 deletion src/coinjoin/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public NetHandler
~CCoinJoinServer();

void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv) override;
bool ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker) override;
bool ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker) override;
bool AlreadyHave(const CInv& inv) override;
void Schedule(CScheduler& scheduler) override;

Expand Down
6 changes: 3 additions & 3 deletions src/governance/net_governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,22 @@ bool NetGovernance::AlreadyHave(const CInv& inv)
return !m_gov_manager.ConfirmInventoryRequest(inv);
}

bool NetGovernance::ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker)
bool NetGovernance::ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker)
{
if (inv.type == MSG_GOVERNANCE_OBJECT) {
if (!m_gov_manager.HaveObjectForHash(inv.hash)) return false;
CDataStream ss(SER_NETWORK, pfrom.GetCommonVersion());
ss.reserve(1000);
if (!m_gov_manager.SerializeObjectForHash(inv.hash, ss)) return false;
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::MNGOVERNANCEOBJECT, ss));
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::MNGOVERNANCEOBJECT, ss));
return true;
}
if (inv.type == MSG_GOVERNANCE_OBJECT_VOTE) {
if (!m_gov_manager.HaveVoteForHash(inv.hash)) return false;
CDataStream ss(SER_NETWORK, pfrom.GetCommonVersion());
ss.reserve(1000);
if (!m_gov_manager.SerializeVoteForHash(inv.hash, ss)) return false;
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::MNGOVERNANCEOBJECTVOTE, ss));
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::MNGOVERNANCEOBJECTVOTE, ss));
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/governance/net_governance.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NetGovernance final : public NetHandler
void ProcessMessage(CNode& peer, const std::string& msg_type, CDataStream& vRecv) override;

bool AlreadyHave(const CInv& inv) override;
bool ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker) override;
bool ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker) override;

private:
CGovernanceManager& m_gov_manager;
Expand Down
16 changes: 8 additions & 8 deletions src/llmq/net_dkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,42 +557,42 @@ bool NetDKG::AlreadyHave(const CInv& inv)
return false;
}

bool NetDKG::ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker)
bool NetDKG::ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker)
{
// Default implementations of GetContribution and the other virtual methods
// return false in observer mode; m_active is only an early exit and does
// not affect logic.
// Observer mode holds no CConnman, so this null check guards the replies
// below rather than merely short-circuiting them. It costs no coverage: the
// Get* calls return false by construction in observer mode.
if (m_active == nullptr) return false;

switch (inv.type) {
case MSG_QUORUM_CONTRIB: {
CDKGContribution o;
if (m_qdkgsman.GetContribution(inv.hash, o)) {
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QCONTRIB, o));
m_active->connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QCONTRIB, o));
return true;
}
return false;
}
case MSG_QUORUM_COMPLAINT: {
CDKGComplaint o;
if (m_qdkgsman.GetComplaint(inv.hash, o)) {
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QCOMPLAINT, o));
m_active->connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QCOMPLAINT, o));
return true;
}
return false;
}
case MSG_QUORUM_JUSTIFICATION: {
CDKGJustification o;
if (m_qdkgsman.GetJustification(inv.hash, o)) {
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QJUSTIFICATION, o));
m_active->connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QJUSTIFICATION, o));
return true;
}
return false;
}
case MSG_QUORUM_PREMATURE_COMMITMENT: {
CDKGPrematureCommitment o;
if (m_qdkgsman.GetPrematureCommitment(inv.hash, o)) {
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QPCOMMITMENT, o));
m_active->connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QPCOMMITMENT, o));
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/net_dkg.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class NetDKG final : public NetHandler
void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv) override
EXCLUSIVE_LOCKS_REQUIRED(!cs_indexed_quorums_cache);
bool AlreadyHave(const CInv& inv) override;
bool ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker) override;
bool ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker) override;
/**
* Drives one phase-handler thread per ActiveDKGSessionHandler in active mode;
* no-op in observer mode (no curSession to drive).
Expand Down
2 changes: 1 addition & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2979,7 +2979,7 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
}
for (auto& handler : m_handlers) {
if (!push) {
push = handler->ProcessGetData(pfrom, inv, m_connman, msgMaker);
push = handler->ProcessGetData(pfrom, inv, msgMaker);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/net_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class NetHandler
virtual bool AlreadyHave(const CInv& inv) { return false; }

// It should return true, if there's data has been pushed
virtual bool ProcessGetData(CNode& pfrom, const CInv& inv, CConnman& connman, const CNetMsgMaker& msgMaker) { return false; }
virtual bool ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker) { return false; }
protected:
PeerManagerInternal* m_peer_manager;
};
Expand Down