Skip to content

Commit c8592b8

Browse files
Merge #6820: refactor: migrate ProcessMessage definitions to MessageProcessingResult, drop PeerMsgRet
491ae50 revert: new util class `expected` for return errors by more convenient way (Kittywhiskers Van Gogh) 2020757 trivial: remove `PeerMsgRet` handling logic (Kittywhiskers Van Gogh) 5d1222e chore: drop govobj/govobjvote counts, use `ret.m_inventory.size()` (UdjinM6) 4822b93 refactor: allow submitting multiple `CInv`s to `MessageProcessingResult` (Kittywhiskers Van Gogh) 0517aff refactor: mark `RelayInv{,Filtered}`'s `CInv` argument as const (Kittywhiskers Van Gogh) 9084530 refactor: migrate `CGovernanceManager::ProcessMessage()` and friends (Kittywhiskers Van Gogh) 8b9bf7c refactor: migrate `CCoinJoinServer::ProcessMessage()` (Kittywhiskers Van Gogh) 1d50a1a refactor: migrate `CCoinJoinClientQueueManager::ProcessMessage()` (Kittywhiskers Van Gogh) 6352baf refactor: migrate `CMNAuth::ProcessMessage()` (Kittywhiskers Van Gogh) 9f85bd0 refactor: migrate `CInstantSendManager::ProcessMessage()` (Kittywhiskers Van Gogh) ef4a0bb refactor: migrate `CDKGSessionManager::ProcessMessage()` and friends (Kittywhiskers Van Gogh) 93d68b8 refactor: migrate `CQuorumManager::ProcessMessage()` (Kittywhiskers Van Gogh) 1bbcb95 refactor: migrate `CSporkManager::ProcessMessage()` and friends (Kittywhiskers Van Gogh) e7b23a2 refactor: migrate `CSigningManager::ProcessMessage()` (Kittywhiskers Van Gogh) f3b98ce chore: add redefinition of `NodeId` to avoid repetitive redefinition (Kittywhiskers Van Gogh) f341ef5 chore: add `nodiscard` attrib to `MessageProcessingResult` ret functions (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for #6821 * To avoid having to redeclare `NodeId` repeatedly to avoid circular dependencies from including `net.h` ([source](https://github.com/dashpay/dash/blob/fb87a5a937dd232d4f2ae60b5b8c5c29d49cb92f/src/net.h#L121)), a redeclaration is made in the relatively lightweight `net_types.h` that as of `develop` (fb87a5a), doesn't have includes outside the standard library ([source](https://github.com/dashpay/dash/blob/fb87a5a937dd232d4f2ae60b5b8c5c29d49cb92f/src/net_types.h#L8-L10)). Redeclarations were flagged during review (see [comment](#6820 (comment)), [comment](#6820 (comment))). * As `tl::expected` was introduced alongside `PeerMsgRet` in [dash#5782](#5782) and has not been used elsewhere, we can safely remove it as we've finished migrating all usage to `MessageProcessingResult`. ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: knst: utACK 491ae50 UdjinM6: utACK 491ae50 Tree-SHA512: c37fe6370555f1c33877fa5a335356e2febf25c2d0d954fa44623f49994647ea2a10aec5ceb9e788bb6fa9315dc00b3e54ca8e0da96c7899fb31c30b888eb732
2 parents 690a1cd + 491ae50 commit c8592b8

34 files changed

+247
-2706
lines changed

contrib/devtools/copyright_header.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
'src/ctpl_stl.h',
2626
'src/test/fuzz/FuzzedDataProvider.h',
2727
'src/tinyformat.h',
28-
'src/util/expected.h',
2928
'src/wallet/bip39.cpp',
3029
'src/wallet/bip39.h',
3130
'src/wallet/bip39_english.h',

src/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ BITCOIN_CORE_H = \
357357
util/enumerate.h \
358358
util/epochguard.h \
359359
util/error.h \
360-
util/expected.h \
361360
util/fastrange.h \
362361
util/fees.h \
363362
util/golombrice.h \

src/chainlock/chainlock.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <chainlock/clsig.h>
99

10+
#include <net_types.h>
1011
#include <primitives/transaction.h>
1112
#include <protocol.h>
1213
#include <saltedhasher.h>
@@ -28,8 +29,6 @@ class CScheduler;
2829
class CSporkManager;
2930
class CTxMemPool;
3031

31-
using NodeId = int64_t;
32-
3332
namespace llmq {
3433
class CInstantSendManager;
3534
class CQuorumManager;

src/chainlock/signing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ChainLockSignerParent
3030
virtual bool HasConflictingChainLock(int nHeight, const uint256& blockHash) const = 0;
3131
virtual bool IsEnabled() const = 0;
3232
virtual bool IsTxSafeForMining(const uint256& txid) const = 0;
33-
virtual MessageProcessingResult ProcessNewChainLock(NodeId from, const ChainLockSig& clsig, const uint256& hash) = 0;
33+
[[nodiscard]] virtual MessageProcessingResult ProcessNewChainLock(NodeId from, const ChainLockSig& clsig, const uint256& hash) = 0;
3434
virtual void UpdateTxFirstSeenMap(const std::unordered_set<uint256, StaticSaltedHasher>& tx, const int64_t& time) = 0;
3535
};
3636

src/coinjoin/client.cpp

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,36 @@ using wallet::CoinType;
3838
using wallet::CWallet;
3939
using wallet::ReserveDestination;
4040

41-
PeerMsgRet CCoinJoinClientQueueManager::ProcessMessage(const CNode& peer, CConnman& connman, PeerManager& peerman,
42-
std::string_view msg_type, CDataStream& vRecv)
41+
MessageProcessingResult CCoinJoinClientQueueManager::ProcessMessage(NodeId from, CConnman& connman, PeerManager& peerman,
42+
std::string_view msg_type, CDataStream& vRecv)
4343
{
44+
if (msg_type != NetMsgType::DSQUEUE) {
45+
return {};
46+
}
47+
4448
if (m_is_masternode) return {};
4549
if (!m_mn_sync.IsBlockchainSynced()) return {};
4650

47-
if (msg_type == NetMsgType::DSQUEUE) {
48-
return CCoinJoinClientQueueManager::ProcessDSQueue(peer, connman, peerman, vRecv);
49-
}
50-
return {};
51-
}
52-
53-
PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnman& connman, PeerManager& peerman,
54-
CDataStream& vRecv)
55-
{
5651
assert(m_mn_metaman.IsValid());
5752

5853
CCoinJoinQueue dsq;
5954
vRecv >> dsq;
6055

61-
{
62-
LOCK(::cs_main);
63-
peerman.EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash()));
64-
}
56+
MessageProcessingResult ret{};
57+
ret.m_to_erase = CInv{MSG_DSQ, dsq.GetHash()};
6558

6659
if (dsq.masternodeOutpoint.IsNull() && dsq.m_protxHash.IsNull()) {
67-
return tl::unexpected{100};
60+
ret.m_error = MisbehavingError{100};
61+
return ret;
6862
}
6963

7064
const auto tip_mn_list = m_dmnman.GetListAtChainTip();
7165
if (dsq.masternodeOutpoint.IsNull()) {
7266
if (auto dmn = tip_mn_list.GetValidMN(dsq.m_protxHash)) {
7367
dsq.masternodeOutpoint = dmn->collateralOutpoint;
7468
} else {
75-
return tl::unexpected{10};
69+
ret.m_error = MisbehavingError{10};
70+
return ret;
7671
}
7772
}
7873

@@ -84,31 +79,32 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
8479
// process every dsq only once
8580
for (const auto &q: vecCoinJoinQueue) {
8681
if (q == dsq) {
87-
return {};
82+
return ret;
8883
}
8984
if (q.fReady == dsq.fReady && q.masternodeOutpoint == dsq.masternodeOutpoint) {
9085
// no way the same mn can send another dsq with the same readiness this soon
9186
LogPrint(BCLog::COINJOIN, /* Continued */
92-
"DSQUEUE -- Peer %s is sending WAY too many dsq messages for a masternode with collateral %s\n",
93-
peer.GetLogString(), dsq.masternodeOutpoint.ToStringShort());
94-
return {};
87+
"DSQUEUE -- Peer %d is sending WAY too many dsq messages for a masternode with collateral %s\n",
88+
from, dsq.masternodeOutpoint.ToStringShort());
89+
return ret;
9590
}
9691
}
9792
} // cs_vecqueue
9893

9994
LogPrint(BCLog::COINJOIN, "DSQUEUE -- %s new\n", dsq.ToString());
10095

101-
if (dsq.IsTimeOutOfBounds()) return {};
96+
if (dsq.IsTimeOutOfBounds()) return ret;
10297

10398
auto dmn = tip_mn_list.GetValidMNByCollateral(dsq.masternodeOutpoint);
104-
if (!dmn) return {};
99+
if (!dmn) return ret;
105100

106101
if (dsq.m_protxHash.IsNull()) {
107102
dsq.m_protxHash = dmn->proTxHash;
108103
}
109104

110105
if (!dsq.CheckSignature(dmn->pdmnState->pubKeyOperator.Get())) {
111-
return tl::unexpected{10};
106+
ret.m_error = MisbehavingError{10};
107+
return ret;
112108
}
113109

114110
// if the queue is ready, submit if we can
@@ -117,7 +113,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
117113
return clientman->TrySubmitDenominate(dmn->proTxHash, connman);
118114
})) {
119115
LogPrint(BCLog::COINJOIN, "DSQUEUE -- CoinJoin queue is ready, masternode=%s, queue=%s\n", dmn->proTxHash.ToString(), dsq.ToString());
120-
return {};
116+
return ret;
121117
} else {
122118
int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq();
123119
int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, tip_mn_list.GetValidMNsCount());
@@ -127,7 +123,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
127123
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
128124
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Masternode %s is sending too many dsq messages\n",
129125
dmn->proTxHash.ToString());
130-
return {};
126+
return ret;
131127
}
132128

133129
m_mn_metaman.AllowMixing(dmn->proTxHash);
@@ -142,7 +138,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
142138
}
143139
} // cs_ProcessDSQueue
144140
peerman.RelayDSQ(dsq);
145-
return {};
141+
return ret;
146142
}
147143

148144
void CCoinJoinClientManager::ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)

src/coinjoin/client.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <coinjoin/util.h>
99
#include <coinjoin/coinjoin.h>
1010

11+
#include <net_types.h>
1112
#include <protocol.h>
1213
#include <util/ranges.h>
1314
#include <util/translation.h>
@@ -252,9 +253,9 @@ class CCoinJoinClientQueueManager : public CCoinJoinBaseManager
252253
m_mn_sync(mn_sync),
253254
m_is_masternode{is_masternode} {};
254255

255-
PeerMsgRet ProcessMessage(const CNode& peer, CConnman& connman, PeerManager& peerman, std::string_view msg_type,
256-
CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
257-
PeerMsgRet ProcessDSQueue(const CNode& peer, CConnman& connman, PeerManager& peerman, CDataStream& vRecv);
256+
[[nodiscard]] MessageProcessingResult ProcessMessage(NodeId from, CConnman& connman, PeerManager& peerman, std::string_view msg_type,
257+
CDataStream& vRecv)
258+
EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
258259
void DoMaintenance();
259260
};
260261

src/coinjoin/server.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323

2424
#include <univalue.h>
2525

26-
PeerMsgRet CCoinJoinServer::ProcessMessage(CNode& peer, std::string_view msg_type, CDataStream& vRecv)
26+
MessageProcessingResult CCoinJoinServer::ProcessMessage(CNode& peer, std::string_view msg_type, CDataStream& vRecv)
2727
{
2828
if (!m_mn_activeman) return {};
2929
if (!m_mn_sync.IsBlockchainSynced()) return {};
3030

3131
if (msg_type == NetMsgType::DSACCEPT) {
3232
ProcessDSACCEPT(peer, vRecv);
3333
} else if (msg_type == NetMsgType::DSQUEUE) {
34-
return ProcessDSQUEUE(peer, vRecv);
34+
return ProcessDSQUEUE(peer.GetId(), vRecv);
3535
} else if (msg_type == NetMsgType::DSVIN) {
3636
ProcessDSVIN(peer, vRecv);
3737
} else if (msg_type == NetMsgType::DSSIGNFINALTX) {
@@ -109,61 +109,62 @@ void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv)
109109
}
110110
}
111111

112-
PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv)
112+
MessageProcessingResult CCoinJoinServer::ProcessDSQUEUE(NodeId from, CDataStream& vRecv)
113113
{
114114
assert(m_mn_metaman.IsValid());
115115

116116
CCoinJoinQueue dsq;
117117
vRecv >> dsq;
118118

119-
{
120-
LOCK(::cs_main);
121-
Assert(m_peerman)->EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash()));
122-
}
119+
MessageProcessingResult ret{};
120+
ret.m_to_erase = CInv{MSG_DSQ, dsq.GetHash()};
123121

124122
if (dsq.masternodeOutpoint.IsNull() && dsq.m_protxHash.IsNull()) {
125-
return tl::unexpected{100};
123+
ret.m_error = MisbehavingError{100};
124+
return ret;
126125
}
127126

128127
const auto tip_mn_list = m_dmnman.GetListAtChainTip();
129128
if (dsq.masternodeOutpoint.IsNull()) {
130129
if (auto dmn = tip_mn_list.GetValidMN(dsq.m_protxHash)) {
131130
dsq.masternodeOutpoint = dmn->collateralOutpoint;
132131
} else {
133-
return tl::unexpected{10};
132+
ret.m_error = MisbehavingError{10};
133+
return ret;
134134
}
135135
}
136136

137137
{
138138
TRY_LOCK(cs_vecqueue, lockRecv);
139-
if (!lockRecv) return {};
139+
if (!lockRecv) return ret;
140140

141141
// process every dsq only once
142142
for (const auto& q : vecCoinJoinQueue) {
143143
if (q == dsq) {
144-
return {};
144+
return ret;
145145
}
146146
if (q.fReady == dsq.fReady && q.masternodeOutpoint == dsq.masternodeOutpoint) {
147147
// no way the same mn can send another dsq with the same readiness this soon
148-
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Peer %s is sending WAY too many dsq messages for a masternode with collateral %s\n", peer.GetLogString(), dsq.masternodeOutpoint.ToStringShort());
149-
return {};
148+
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Peer %d is sending WAY too many dsq messages for a masternode with collateral %s\n", from, dsq.masternodeOutpoint.ToStringShort());
149+
return ret;
150150
}
151151
}
152152
} // cs_vecqueue
153153

154154
LogPrint(BCLog::COINJOIN, "DSQUEUE -- %s new\n", dsq.ToString());
155155

156-
if (dsq.IsTimeOutOfBounds()) return {};
156+
if (dsq.IsTimeOutOfBounds()) return ret;
157157

158158
auto dmn = tip_mn_list.GetValidMNByCollateral(dsq.masternodeOutpoint);
159-
if (!dmn) return {};
159+
if (!dmn) return ret;
160160

161161
if (dsq.m_protxHash.IsNull()) {
162162
dsq.m_protxHash = dmn->proTxHash;
163163
}
164164

165165
if (!dsq.CheckSignature(dmn->pdmnState->pubKeyOperator.Get())) {
166-
return tl::unexpected{10};
166+
ret.m_error = MisbehavingError{10};
167+
return ret;
167168
}
168169

169170
if (!dsq.fReady) {
@@ -173,18 +174,18 @@ PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv
173174
//don't allow a few nodes to dominate the queuing process
174175
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
175176
LogPrint(BCLog::COINJOIN, "DSQUEUE -- node sending too many dsq messages, masternode=%s\n", dmn->proTxHash.ToString());
176-
return {};
177+
return ret;
177178
}
178179
m_mn_metaman.AllowMixing(dmn->proTxHash);
179180

180181
LogPrint(BCLog::COINJOIN, "DSQUEUE -- new CoinJoin queue, masternode=%s, queue=%s\n", dmn->proTxHash.ToString(), dsq.ToString());
181182

182183
TRY_LOCK(cs_vecqueue, lockRecv);
183-
if (!lockRecv) return {};
184+
if (!lockRecv) return ret;
184185
vecCoinJoinQueue.push_back(dsq);
185186
m_peerman->RelayDSQ(dsq);
186187
}
187-
return {};
188+
return ret;
188189
}
189190

190191
void CCoinJoinServer::ProcessDSVIN(CNode& peer, CDataStream& vRecv)

src/coinjoin/server.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <coinjoin/coinjoin.h>
99

10+
#include <net_types.h>
1011
#include <protocol.h>
1112

1213
class CActiveMasternodeManager;
@@ -85,7 +86,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
8586
void RelayCompletedTransaction(PoolMessage nMessageID) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
8687

8788
void ProcessDSACCEPT(CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
88-
PeerMsgRet ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
89+
[[nodiscard]] MessageProcessingResult ProcessDSQUEUE(NodeId from, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
8990
void ProcessDSVIN(CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
9091
void ProcessDSSIGNFINALTX(CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
9192

@@ -110,7 +111,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
110111
fUnitTest(false)
111112
{}
112113

113-
PeerMsgRet ProcessMessage(CNode& pfrom, std::string_view msg_type, CDataStream& vRecv);
114+
[[nodiscard]] MessageProcessingResult ProcessMessage(CNode& pfrom, std::string_view msg_type, CDataStream& vRecv);
114115

115116
bool HasTimedOut() const;
116117
void CheckTimeout();

src/evo/mnauth.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ void CMNAuth::PushMNAUTH(CNode& peer, CConnman& connman, const CActiveMasternode
5555
connman.PushMessage(&peer, CNetMsgMaker(peer.GetCommonVersion()).Make(NetMsgType::MNAUTH, mnauth));
5656
}
5757

58-
PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman,
59-
const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list,
60-
std::string_view msg_type, CDataStream& vRecv)
58+
MessageProcessingResult CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman,
59+
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
60+
const CDeterministicMNList& tip_mn_list, std::string_view msg_type, CDataStream& vRecv)
6161
{
6262
assert(mn_metaman.IsValid());
6363

@@ -71,30 +71,30 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CCon
7171

7272
// only one MNAUTH allowed
7373
if (!peer.GetVerifiedProRegTxHash().IsNull()) {
74-
return tl::unexpected{MisbehavingError{100, "duplicate mnauth"}};
74+
return MisbehavingError{100, "duplicate mnauth"};
7575
}
7676

7777
if ((~node_services) & (NODE_NETWORK | NODE_BLOOM)) {
7878
// either NODE_NETWORK or NODE_BLOOM bit is missing in node's services
79-
return tl::unexpected{MisbehavingError{100, "mnauth from a node with invalid services"}};
79+
return MisbehavingError{100, "mnauth from a node with invalid services"};
8080
}
8181

8282
if (mnauth.proRegTxHash.IsNull()) {
83-
return tl::unexpected{MisbehavingError{100, "empty mnauth proRegTxHash"}};
83+
return MisbehavingError{100, "empty mnauth proRegTxHash"};
8484
}
8585

8686
if (!mnauth.sig.IsValid()) {
8787
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- invalid mnauth for protx=%s with sig=%s\n",
8888
mnauth.proRegTxHash.ToString(), mnauth.sig.ToString(false));
89-
return tl::unexpected{MisbehavingError{100, "invalid mnauth signature"}};
89+
return MisbehavingError{100, "invalid mnauth signature"};
9090
}
9191

9292
const auto dmn = tip_mn_list.GetMN(mnauth.proRegTxHash);
9393
if (!dmn) {
9494
// in case node was unlucky and not up to date, just let it be connected as a regular node, which gives it
9595
// a chance to get up-to-date and thus realize that it's not a MN anymore. We still give it a
9696
// low DoS score.
97-
return tl::unexpected{MisbehavingError{10, "missing mnauth masternode"}};
97+
return MisbehavingError{10, "missing mnauth masternode"};
9898
}
9999

100100
uint256 signHash;
@@ -114,7 +114,7 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CCon
114114
if (!mnauth.sig.VerifyInsecure(dmn->pdmnState->pubKeyOperator.Get(), signHash, false)) {
115115
// Same as above, MN seems to not know its fate yet, so give it a chance to update. If this is a
116116
// malicious node (DoSing us), it'll get banned soon.
117-
return tl::unexpected{MisbehavingError{10, "mnauth signature verification failed"}};
117+
return MisbehavingError{10, "mnauth signature verification failed"};
118118
}
119119

120120
if (!peer.IsInboundConn()) {

src/evo/mnauth.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ class CMNAuth
5858
* @pre CMasternodeMetaMan's database must be successfully loaded before
5959
* attempting to call this function regardless of sync state
6060
*/
61-
static PeerMsgRet ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman,
62-
const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list,
63-
std::string_view msg_type, CDataStream& vRecv);
61+
[[nodiscard]] static MessageProcessingResult ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman,
62+
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
63+
const CDeterministicMNList& tip_mn_list, std::string_view msg_type, CDataStream& vRecv);
6464
static void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff, CConnman& connman);
6565
};
6666

0 commit comments

Comments
 (0)