Skip to content

Commit

Permalink
Introduce SENDDSQUEUE to indicate that a node is interested in DSQ me…
Browse files Browse the repository at this point in the history
…ssages (#2785)
  • Loading branch information
codablock committed Mar 21, 2019
1 parent 9e70209 commit 9a1362a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,9 @@ class CNode
// Whether a ping is requested.
std::atomic<bool> fPingQueued;

// If true, we will send him PrivateSend queue messages
std::atomic<bool> fSendDSQueue{false};

// If true, we will announce/send him plain recovered sigs (usually true for full nodes)
std::atomic<bool> fSendRecSigs{false};
// If true, we will send him all quorum related messages, even if he is not a member of our quorums
Expand Down
17 changes: 17 additions & 0 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,15 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion));
}

if (pfrom->nVersion >= SENDDSQUEUE_PROTO_VERSION) {
// Tell our peer that he should send us PrivateSend queue messages
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::SENDDSQUEUE, true));
} else {
// older nodes do not support SENDDSQUEUE and expect us to always send PrivateSend queue messages
// TODO we can remove this compatibility code in 0.15.0
pfrom->fSendDSQueue = true;
}

if (pfrom->nVersion >= LLMQS_PROTO_VERSION) {
// Tell our peer that we're interested in plain LLMQ recovered signatures.
// Otherwise the peer would only announce/send messages resulting from QRECSIG,
Expand Down Expand Up @@ -1771,6 +1780,14 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
}


else if (strCommand == NetMsgType::SENDDSQUEUE)
{
bool b;
vRecv >> b;
pfrom->fSendDSQueue = b;
}


else if (strCommand == NetMsgType::QSENDRECSIGS) {
bool b;
vRecv >> b;
Expand Down
2 changes: 1 addition & 1 deletion src/privatesend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ bool CPrivateSendQueue::Relay(CConnman& connman)
{
connman.ForEachNode([&connman, this](CNode* pnode) {
CNetMsgMaker msgMaker(pnode->GetSendVersion());
if (pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION)
if (pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION && pnode->fSendDSQueue)
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSQUEUE, (*this)));
});
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const char *DSCOMPLETE="dsc";
const char *DSSTATUSUPDATE="dssu";
const char *DSTX="dstx";
const char *DSQUEUE="dsq";
const char *SENDDSQUEUE="senddsq";
const char *SYNCSTATUSCOUNT="ssc";
const char *MNGOVERNANCESYNC="govsync";
const char *MNGOVERNANCEOBJECT="govobj";
Expand Down Expand Up @@ -148,6 +149,7 @@ const static std::string allNetMessageTypes[] = {
NetMsgType::TXLOCKVOTE,
NetMsgType::SPORK,
NetMsgType::GETSPORKS,
NetMsgType::SENDDSQUEUE,
NetMsgType::DSACCEPT,
NetMsgType::DSVIN,
NetMsgType::DSFINALTX,
Expand Down
1 change: 1 addition & 0 deletions src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ extern const char *DSCOMPLETE;
extern const char *DSSTATUSUPDATE;
extern const char *DSTX;
extern const char *DSQUEUE;
extern const char *SENDDSQUEUE;
extern const char *SYNCSTATUSCOUNT;
extern const char *MNGOVERNANCESYNC;
extern const char *MNGOVERNANCEOBJECT;
Expand Down
4 changes: 4 additions & 0 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ static const int DMN_PROTO_VERSION = 70213;
//! introduction of LLMQs
static const int LLMQS_PROTO_VERSION = 70214;

//! introduction of SENDDSQUEUE
//! TODO we can remove this in 0.15.0.0
static const int SENDDSQUEUE_PROTO_VERSION = 70214;

#endif // BITCOIN_VERSION_H

0 comments on commit 9a1362a

Please sign in to comment.