@@ -92,8 +92,8 @@ void CDKGSessionManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fIni
9292 }
9393}
9494
95- PeerMsgRet CDKGSessionManager::ProcessMessage (CNode& pfrom, PeerManager& peerman, bool is_masternode ,
96- const std::string& msg_type, CDataStream& vRecv)
95+ MessageProcessingResult CDKGSessionManager::ProcessMessage (CNode& pfrom, bool is_masternode, std::string_view msg_type ,
96+ CDataStream& vRecv)
9797{
9898 static Mutex cs_indexedQuorumsCache;
9999 static std::map<Consensus::LLMQType, unordered_lru_cache<uint256, int , StaticSaltedHasher>> indexedQuorumsCache GUARDED_BY (cs_indexedQuorumsCache);
@@ -112,19 +112,19 @@ PeerMsgRet CDKGSessionManager::ProcessMessage(CNode& pfrom, PeerManager& peerman
112112 if (msg_type == NetMsgType::QWATCH) {
113113 if (!is_masternode) {
114114 // non-masternodes should never receive this
115- return tl::unexpected {10 };
115+ return MisbehavingError {10 };
116116 }
117117 pfrom.qwatch = true ;
118118 return {};
119119 }
120120
121121 if ((!is_masternode && !IsWatchQuorumsEnabled ())) {
122122 // regular non-watching nodes should never receive any of these
123- return tl::unexpected {10 };
123+ return MisbehavingError {10 };
124124 }
125125
126126 if (vRecv.empty ()) {
127- return tl::unexpected {100 };
127+ return MisbehavingError {100 };
128128 }
129129
130130 Consensus::LLMQType llmqType;
@@ -137,7 +137,7 @@ PeerMsgRet CDKGSessionManager::ProcessMessage(CNode& pfrom, PeerManager& peerman
137137 const auto & llmq_params_opt = Params ().GetLLMQ (llmqType);
138138 if (!llmq_params_opt.has_value ()) {
139139 LogPrintf (" CDKGSessionManager -- invalid llmqType [%d]\n " , ToUnderlying (llmqType));
140- return tl::unexpected {100 };
140+ return MisbehavingError {100 };
141141 }
142142 const auto & llmq_params = llmq_params_opt.value ();
143143
@@ -158,12 +158,12 @@ PeerMsgRet CDKGSessionManager::ProcessMessage(CNode& pfrom, PeerManager& peerman
158158 if (pQuorumBaseBlockIndex == nullptr ) {
159159 LogPrintf (" CDKGSessionManager -- unknown quorumHash %s\n " , quorumHash.ToString ());
160160 // NOTE: do not insta-ban for this, we might be lagging behind
161- return tl::unexpected {10 };
161+ return MisbehavingError {10 };
162162 }
163163
164164 if (!IsQuorumTypeEnabled (llmqType, pQuorumBaseBlockIndex->pprev )) {
165165 LogPrintf (" CDKGSessionManager -- llmqType [%d] quorums aren't active\n " , ToUnderlying (llmqType));
166- return tl::unexpected {100 };
166+ return MisbehavingError {100 };
167167 }
168168
169169 quorumIndex = pQuorumBaseBlockIndex->nHeight % llmq_params.dkgInterval ;
@@ -172,19 +172,18 @@ PeerMsgRet CDKGSessionManager::ProcessMessage(CNode& pfrom, PeerManager& peerman
172172
173173 if (quorumIndex > quorumIndexMax) {
174174 LogPrintf (" CDKGSessionManager -- invalid quorumHash %s\n " , quorumHash.ToString ());
175- return tl::unexpected {100 };
175+ return MisbehavingError {100 };
176176 }
177177
178178 if (!dkgSessionHandlers.count (std::make_pair (llmqType, quorumIndex))) {
179179 LogPrintf (" CDKGSessionManager -- no session handlers for quorumIndex [%d]\n " , quorumIndex);
180- return tl::unexpected {100 };
180+ return MisbehavingError {100 };
181181 }
182182 }
183183
184184 assert (quorumIndex != -1 );
185185 WITH_LOCK (cs_indexedQuorumsCache, indexedQuorumsCache[llmqType].insert (quorumHash, quorumIndex));
186- dkgSessionHandlers.at (std::make_pair (llmqType, quorumIndex)).ProcessMessage (pfrom, peerman, msg_type, vRecv);
187- return {};
186+ return dkgSessionHandlers.at (std::make_pair (llmqType, quorumIndex)).ProcessMessage (pfrom.GetId (), msg_type, vRecv);
188187}
189188
190189bool CDKGSessionManager::AlreadyHave (const CInv& inv) const
0 commit comments