Skip to content

Commit 50df807

Browse files
committed
[Net] Introduce NetMsgType for inter-quorum communication messages
1 parent 5c923cf commit 50df807

File tree

4 files changed

+72
-9
lines changed

4 files changed

+72
-9
lines changed

src/net_processing.cpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
22
// Copyright (c) 2009-2016 The Bitcoin Core developers
3-
// Copyright (c) 2015-2020 The PIVX developers
3+
// Copyright (c) 2014-2021 The Dash Core developers
4+
// Copyright (c) 2015-2022 The PIVX developers
45
// Distributed under the MIT software license, see the accompanying
56
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
67

@@ -837,6 +838,12 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
837838
return mnodeman.mapSeenMasternodePing.count(inv.hash);
838839
case MSG_QUORUM_FINAL_COMMITMENT:
839840
return llmq::quorumBlockProcessor->HasMinableCommitment(inv.hash);
841+
case MSG_QUORUM_CONTRIB:
842+
case MSG_QUORUM_COMPLAINT:
843+
case MSG_QUORUM_JUSTIFICATION:
844+
case MSG_QUORUM_PREMATURE_COMMITMENT:
845+
// !TODO: AlreadyHave
846+
return false;
840847
}
841848
// Don't know what it is, just say we already got one
842849
return true;
@@ -902,6 +909,26 @@ bool static PushTierTwoGetDataRequest(const CInv& inv,
902909
}
903910
}
904911

912+
if (inv.type == MSG_QUORUM_CONTRIB) {
913+
// !TODO
914+
return false;
915+
}
916+
917+
if (inv.type == MSG_QUORUM_COMPLAINT) {
918+
// !TODO
919+
return false;
920+
}
921+
922+
if (inv.type == MSG_QUORUM_JUSTIFICATION) {
923+
// !TODO
924+
return false;
925+
}
926+
927+
if (inv.type == MSG_QUORUM_PREMATURE_COMMITMENT) {
928+
// !TODO
929+
return false;
930+
}
931+
905932
// !TODO: remove when transition to DMN is complete
906933
if (inv.type == MSG_MASTERNODE_WINNER && !deterministicMNManager->LegacyMNObsolete()) {
907934
if (masternodePayments.mapMasternodePayeeVotes.count(inv.hash)) {
@@ -1051,7 +1078,11 @@ bool static IsTierTwoInventoryTypeKnown(int type)
10511078
type == MSG_BUDGET_FINALIZED_VOTE ||
10521079
type == MSG_MASTERNODE_ANNOUNCE ||
10531080
type == MSG_MASTERNODE_PING ||
1054-
type == MSG_QUORUM_FINAL_COMMITMENT;
1081+
type == MSG_QUORUM_FINAL_COMMITMENT ||
1082+
type == MSG_QUORUM_CONTRIB ||
1083+
type == MSG_QUORUM_COMPLAINT ||
1084+
type == MSG_QUORUM_JUSTIFICATION ||
1085+
type == MSG_QUORUM_PREMATURE_COMMITMENT;
10551086
}
10561087

10571088
void static ProcessGetData(CNode* pfrom, CConnman* connman, const std::atomic<bool>& interruptMsgProc)

src/protocol.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
22
// Copyright (c) 2009-2014 The Bitcoin developers
3-
// Copyright (c) 2014-2015 The Dash developers
4-
// Copyright (c) 2017-2020 The PIVX developers
3+
// Copyright (c) 2014-2021 The Dash Core developers
4+
// Copyright (c) 2017-2022 The PIVX developers
55
// Distributed under the MIT/X11 software license, see the accompanying
66
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
77

@@ -56,8 +56,13 @@ const char* GETMNLIST = "dseg";
5656
const char* QFCOMMITMENT = "qfcommit";
5757
const char* QSENDRECSIGS = "qsendrecsigs";
5858
const char* MNAUTH = "mnauth";
59+
const char* QCONTRIB = "qcontrib";
60+
const char* QCOMPLAINT = "qcomplaint";
61+
const char* QJUSTIFICATION = "qjustify";
62+
const char* QPCOMMITMENT = "qpcommit";
5963
}; // namespace NetMsgType
6064

65+
6166
/** All known message types. Keep this in the same order as the list of
6267
* messages above and in protocol.h.
6368
*/
@@ -107,7 +112,11 @@ const static std::string allNetMessageTypes[] = {
107112
NetMsgType::MNBROADCAST2,
108113
NetMsgType::QFCOMMITMENT,
109114
NetMsgType::QSENDRECSIGS,
110-
NetMsgType::MNAUTH
115+
NetMsgType::MNAUTH,
116+
NetMsgType::QCONTRIB,
117+
NetMsgType::QCOMPLAINT,
118+
NetMsgType::QJUSTIFICATION,
119+
NetMsgType::QPCOMMITMENT
111120
};
112121
const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes + ARRAYLEN(allNetMessageTypes));
113122
const static std::vector<std::string> tiertwoNetMessageTypesVec(std::find(allNetMessageTypesVec.begin(), allNetMessageTypesVec.end(), NetMsgType::SPORK), allNetMessageTypesVec.end());
@@ -207,6 +216,10 @@ std::string CInv::GetCommand() const
207216
case MSG_MASTERNODE_PING: return cmd.append(NetMsgType::MNPING);
208217
case MSG_DSTX: return cmd.append("dstx"); // Deprecated
209218
case MSG_QUORUM_FINAL_COMMITMENT: return cmd.append(NetMsgType::QFCOMMITMENT);
219+
case MSG_QUORUM_CONTRIB: return cmd.append(NetMsgType::QCONTRIB);
220+
case MSG_QUORUM_COMPLAINT: return cmd.append(NetMsgType::QCOMPLAINT);
221+
case MSG_QUORUM_JUSTIFICATION: return cmd.append(NetMsgType::QJUSTIFICATION);
222+
case MSG_QUORUM_PREMATURE_COMMITMENT: return cmd.append(NetMsgType::QPCOMMITMENT);
210223
default:
211224
throw std::out_of_range(strprintf("%s: type=%d unknown type", __func__, type));
212225
}

src/protocol.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
22
// Copyright (c) 2009-2015 The Bitcoin developers
3-
// Copyright (c) 2014-2015 The Dash developers
4-
// Copyright (c) 2016-2020 The PIVX developers
3+
// Copyright (c) 2014-2021 The Dash Core developers
4+
// Copyright (c) 2016-2022 The PIVX developers
55
// Distributed under the MIT/X11 software license, see the accompanying
66
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
77

@@ -286,6 +286,13 @@ extern const char* QSENDRECSIGS;
286286
* The mnauth message is used authenticate MN connections
287287
*/
288288
extern const char* MNAUTH;
289+
/*
290+
* Messages for LLMQ-DKG inter-quorum communication
291+
*/
292+
extern const char* QCONTRIB;
293+
extern const char* QCOMPLAINT;
294+
extern const char* QJUSTIFICATION;
295+
extern const char* QPCOMMITMENT;
289296
}; // namespace NetMsgType
290297

291298
/* Get a vector of all valid message types (see above) */
@@ -439,7 +446,11 @@ enum GetDataMsg
439446
MSG_MASTERNODE_PING,
440447
MSG_DSTX, // Deprecated
441448
MSG_QUORUM_FINAL_COMMITMENT,
442-
MSG_TYPE_MAX = MSG_QUORUM_FINAL_COMMITMENT
449+
MSG_QUORUM_CONTRIB,
450+
MSG_QUORUM_COMPLAINT,
451+
MSG_QUORUM_JUSTIFICATION,
452+
MSG_QUORUM_PREMATURE_COMMITMENT,
453+
MSG_TYPE_MAX = MSG_QUORUM_PREMATURE_COMMITMENT
443454
};
444455

445456
/** inv message data */

src/tiertwo_networksync.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020 The PIVX developers
1+
// Copyright (c) 2020-2022 The PIVX developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
44

@@ -59,6 +59,14 @@ bool CMasternodeSync::MessageDispatcher(CNode* pfrom, std::string& strCommand, C
5959
return true;
6060
}
6161

62+
if (strCommand == NetMsgType::QCONTRIB
63+
|| strCommand == NetMsgType::QCOMPLAINT
64+
|| strCommand == NetMsgType::QJUSTIFICATION
65+
|| strCommand == NetMsgType::QPCOMMITMENT) {
66+
// !TODO
67+
return false;
68+
}
69+
6270
if (strCommand == NetMsgType::GETMNLIST) {
6371
// Get Masternode list or specific entry
6472
CTxIn vin;

0 commit comments

Comments
 (0)