Skip to content

Commit 12274e5

Browse files
authored
Introduce "qsendrecsigs" to indicate that plain recovered sigs should be sent (#2783)
* Introduce "qsendrecsigs" to indicate that plain recovered sigs should be sent Full nodes, including masternodes, will send this message automatically. Other node implementations (e.g. SPV) are usually not interested and would not send this message. * Use std::atomic<bool> instead of std::atomic_bool Not related to this PR, but a small enough change to include it here as well.
1 parent 60a9184 commit 12274e5

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

src/llmq/quorums_signing.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,11 @@ void CSigningManager::ProcessRecoveredSig(NodeId nodeId, const CRecoveredSig& re
519519
}
520520

521521
CInv inv(MSG_QUORUM_RECOVERED_SIG, recoveredSig.GetHash());
522-
g_connman->RelayInv(inv, LLMQS_PROTO_VERSION);
522+
g_connman->ForEachNode([&](CNode* pnode) {
523+
if (pnode->nVersion >= LLMQS_PROTO_VERSION && pnode->fSendRecSigs) {
524+
pnode->PushInventory(inv);
525+
}
526+
});
523527

524528
for (auto& l : listeners) {
525529
l->HandleNewRecoveredSig(recoveredSig);

src/net.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,10 @@ class CNode
817817
// Whether a ping is requested.
818818
std::atomic<bool> fPingQueued;
819819

820+
// If true, we will announce/send him plain recovered sigs (usually true for full nodes)
821+
std::atomic<bool> fSendRecSigs{false};
820822
// If true, we will send him all quorum related messages, even if he is not a member of our quorums
821-
std::atomic_bool qwatch{false};
823+
std::atomic<bool> qwatch{false};
822824

823825
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const std::string &addrNameIn = "", bool fInboundIn = false);
824826
~CNode();

src/net_processing.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,14 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
16811681
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion));
16821682
}
16831683

1684+
if (pfrom->nVersion >= LLMQS_PROTO_VERSION) {
1685+
// Tell our peer that we're interested in plain LLMQ recovered signatures.
1686+
// Otherwise the peer would only announce/send messages resulting from QRECSIG,
1687+
// e.g. InstantSend locks or ChainLocks. SPV nodes should not send this message
1688+
// as they are usually only interested in the higher level messages
1689+
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::QSENDRECSIGS, true));
1690+
}
1691+
16841692
if (GetBoolArg("-watchquorums", llmq::DEFAULT_WATCH_QUORUMS)) {
16851693
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::QWATCH));
16861694
}
@@ -1763,6 +1771,13 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
17631771
}
17641772

17651773

1774+
else if (strCommand == NetMsgType::QSENDRECSIGS) {
1775+
bool b;
1776+
vRecv >> b;
1777+
pfrom->fSendRecSigs = b;
1778+
}
1779+
1780+
17661781
else if (strCommand == NetMsgType::INV)
17671782
{
17681783
std::vector<CInv> vInv;

src/protocol.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const char *MNGOVERNANCEOBJECT="govobj";
5858
const char *MNGOVERNANCEOBJECTVOTE="govobjvote";
5959
const char *GETMNLISTDIFF="getmnlistd";
6060
const char *MNLISTDIFF="mnlistdiff";
61+
const char *QSENDRECSIGS="qsendrecsigs";
6162
const char *QFCOMMITMENT="qfcommit";
6263
const char *QCONTRIB="qcontrib";
6364
const char *QCOMPLAINT="qcomplaint";
@@ -161,6 +162,7 @@ const static std::string allNetMessageTypes[] = {
161162
NetMsgType::MNGOVERNANCEOBJECTVOTE,
162163
NetMsgType::GETMNLISTDIFF,
163164
NetMsgType::MNLISTDIFF,
165+
NetMsgType::QSENDRECSIGS,
164166
NetMsgType::QFCOMMITMENT,
165167
NetMsgType::QCONTRIB,
166168
NetMsgType::QCOMPLAINT,

src/protocol.h

+1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ extern const char *MNGOVERNANCEOBJECT;
264264
extern const char *MNGOVERNANCEOBJECTVOTE;
265265
extern const char *GETMNLISTDIFF;
266266
extern const char *MNLISTDIFF;
267+
extern const char *QSENDRECSIGS;
267268
extern const char *QFCOMMITMENT;
268269
extern const char *QCONTRIB;
269270
extern const char *QCOMPLAINT;

0 commit comments

Comments
 (0)