diff --git a/src/llmq/context.cpp b/src/llmq/context.cpp index 87cf1b9392533..11c9851425cda 100644 --- a/src/llmq/context.cpp +++ b/src/llmq/context.cpp @@ -34,7 +34,7 @@ LLMQContext::LLMQContext(ChainstateManager& chainman, CConnman& connman, CDeterm *quorum_block_processor, mn_activeman, mn_sync, sporkman, unit_tests, wipe)}, sigman{std::make_unique(mn_activeman, chainman.ActiveChainstate(), *qman, unit_tests, wipe)}, - shareman{std::make_unique(connman, *sigman, mn_activeman, *qman, sporkman, peerman)}, + shareman{std::make_unique(*sigman, mn_activeman, *qman, sporkman)}, clhandler{[&]() -> llmq::CChainLocksHandler* const { assert(llmq::chainLocksHandler == nullptr); llmq::chainLocksHandler = std::make_unique(chainman.ActiveChainstate(), *qman, @@ -83,7 +83,7 @@ void LLMQContext::Start(CConnman& connman, PeerManager& peerman) } qman->Start(); shareman->RegisterAsRecoveredSigsListener(); - shareman->StartWorkerThread(); + shareman->StartWorkerThread(connman, peerman); sigman->StartWorkerThread(peerman); llmq::chainLocksHandler->Start(); diff --git a/src/llmq/dkgsessionhandler.cpp b/src/llmq/dkgsessionhandler.cpp index 0eee8feb4af92..a773af25f7af5 100644 --- a/src/llmq/dkgsessionhandler.cpp +++ b/src/llmq/dkgsessionhandler.cpp @@ -433,7 +433,8 @@ std::set BatchVerifyMessageSigs(CDKGSession& session, const std::vector< return ret; } -static void RelayInvToParticipants(const CDKGSession& session, CConnman& connman, PeerManager& peerman, const CInv& inv) +static void RelayInvToParticipants(const CDKGSession& session, const CConnman& connman, PeerManager& peerman, + const CInv& inv) { CDKGLogger logger(session, __func__, __LINE__); std::stringstream ss; @@ -466,7 +467,7 @@ static void RelayInvToParticipants(const CDKGSession& session, CConnman& connman } template -bool ProcessPendingMessageBatch(CConnman& connman, CDKGSession& session, CDKGPendingMessages& pendingMessages, +bool ProcessPendingMessageBatch(const CConnman& connman, CDKGSession& session, CDKGPendingMessages& pendingMessages, PeerManager& peerman, size_t maxCount) { auto msgs = pendingMessages.PopAndDeserializeMessages(maxCount); diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index 4e7de954062bc..3c8b71f259fc9 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -178,14 +178,15 @@ void CSigSharesNodeState::RemoveSession(const uint256& signHash) ////////////////////// -void CSigSharesManager::StartWorkerThread() +void CSigSharesManager::StartWorkerThread(CConnman& connman, PeerManager& peerman) { // can't start new thread if we have one running already if (workThread.joinable()) { assert(false); } - workThread = std::thread(&util::TraceThread, "sigshares", [this] { WorkThreadMain(); }); + workThread = std::thread(&util::TraceThread, "sigshares", + [this, &connman, &peerman] { WorkThreadMain(connman, peerman); }); } void CSigSharesManager::StopWorkerThread() @@ -215,7 +216,8 @@ void CSigSharesManager::InterruptWorkerThread() workInterrupt(); } -void CSigSharesManager::ProcessMessage(const CNode& pfrom, const CSporkManager& sporkman, const std::string& msg_type, CDataStream& vRecv) +void CSigSharesManager::ProcessMessage(const CNode& pfrom, PeerManager& peerman, const CSporkManager& sporkman, + const std::string& msg_type, CDataStream& vRecv) { // non-masternodes are not interested in sigshares if (m_mn_activeman == nullptr) return; @@ -227,12 +229,12 @@ void CSigSharesManager::ProcessMessage(const CNode& pfrom, const CSporkManager& if (receivedSigShares.size() > MAX_MSGS_SIG_SHARES) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many sigs in QSIGSHARE message. cnt=%d, max=%d, node=%d\n", __func__, receivedSigShares.size(), MAX_MSGS_SIG_SHARES, pfrom.GetId()); - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } for (const auto& sigShare : receivedSigShares) { - ProcessMessageSigShare(pfrom.GetId(), sigShare); + ProcessMessageSigShare(pfrom.GetId(), peerman, sigShare); } } @@ -241,12 +243,12 @@ void CSigSharesManager::ProcessMessage(const CNode& pfrom, const CSporkManager& vRecv >> msgs; if (msgs.size() > MAX_MSGS_CNT_QSIGSESANN) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many announcements in QSIGSESANN message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSESANN, pfrom.GetId()); - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } if (!ranges::all_of(msgs, [this, &pfrom](const auto& ann){ return ProcessMessageSigSesAnn(pfrom, ann); })) { - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } } else if (msg_type == NetMsgType::QSIGSHARESINV) { @@ -254,12 +256,12 @@ void CSigSharesManager::ProcessMessage(const CNode& pfrom, const CSporkManager& vRecv >> msgs; if (msgs.size() > MAX_MSGS_CNT_QSIGSHARESINV) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many invs in QSIGSHARESINV message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSHARESINV, pfrom.GetId()); - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } if (!ranges::all_of(msgs, [this, &pfrom](const auto& inv){ return ProcessMessageSigSharesInv(pfrom, inv); })) { - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } } else if (msg_type == NetMsgType::QGETSIGSHARES) { @@ -267,12 +269,12 @@ void CSigSharesManager::ProcessMessage(const CNode& pfrom, const CSporkManager& vRecv >> msgs; if (msgs.size() > MAX_MSGS_CNT_QGETSIGSHARES) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many invs in QGETSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QGETSIGSHARES, pfrom.GetId()); - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } if (!ranges::all_of(msgs, [this, &pfrom](const auto& inv){ return ProcessMessageGetSigShares(pfrom, inv); })) { - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } } else if (msg_type == NetMsgType::QBSIGSHARES) { @@ -284,12 +286,12 @@ void CSigSharesManager::ProcessMessage(const CNode& pfrom, const CSporkManager& } if (totalSigsCount > MAX_MSGS_TOTAL_BATCHED_SIGS) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many sigs in QBSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_TOTAL_BATCHED_SIGS, pfrom.GetId()); - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } if (!ranges::all_of(msgs, [this, &pfrom](const auto& bs){ return ProcessMessageBatchedSigShares(pfrom, bs); })) { - BanNode(pfrom.GetId()); + BanNode(pfrom.GetId(), peerman); return; } } @@ -454,7 +456,7 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(const CNode& pfrom, const return true; } -void CSigSharesManager::ProcessMessageSigShare(NodeId fromId, const CSigShare& sigShare) +void CSigSharesManager::ProcessMessageSigShare(NodeId fromId, PeerManager& peerman, const CSigShare& sigShare) { assert(m_mn_activeman); @@ -479,12 +481,12 @@ void CSigSharesManager::ProcessMessageSigShare(NodeId fromId, const CSigShare& s if (sigShare.getQuorumMember() >= quorum->members.size()) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- quorumMember out of bounds\n", __func__); - BanNode(fromId); + BanNode(fromId, peerman); return; } if (!quorum->qc->validMembers[sigShare.getQuorumMember()]) { LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- quorumMember not valid\n", __func__); - BanNode(fromId); + BanNode(fromId, peerman); return; } @@ -620,7 +622,7 @@ bool CSigSharesManager::CollectPendingSigSharesToVerify( return true; } -bool CSigSharesManager::ProcessPendingSigShares(const CConnman& connman) +bool CSigSharesManager::ProcessPendingSigShares(PeerManager& peerman, const CConnman& connman) { std::unordered_map> sigSharesByNodes; std::unordered_map, CQuorumCPtr, StaticSaltedHasher> quorums; @@ -646,7 +648,7 @@ bool CSigSharesManager::ProcessPendingSigShares(const CConnman& connman) // we didn't check this earlier because we use a lazy BLS signature and tried to avoid doing the expensive // deserialization in the message thread if (!sigShare.sigShare.Get().IsValid()) { - BanNode(nodeId); + BanNode(nodeId, peerman); // don't process any additional shares from this node break; } @@ -678,25 +680,26 @@ bool CSigSharesManager::ProcessPendingSigShares(const CConnman& connman) LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- invalid sig shares from other node, banning peer=%d\n", __func__, nodeId); // this will also cause re-requesting of the shares that were sent by this node - BanNode(nodeId); + BanNode(nodeId, peerman); continue; } - ProcessPendingSigShares(v, quorums, connman); + ProcessPendingSigShares(v, quorums, peerman, connman); } return sigSharesByNodes.size() >= nMaxBatchSize; } // It's ensured that no duplicates are passed to this method -void CSigSharesManager::ProcessPendingSigShares(const std::vector& sigSharesToProcess, - const std::unordered_map, CQuorumCPtr, StaticSaltedHasher>& quorums, - const CConnman& connman) +void CSigSharesManager::ProcessPendingSigShares( + const std::vector& sigSharesToProcess, + const std::unordered_map, CQuorumCPtr, StaticSaltedHasher>& quorums, + PeerManager& peerman, const CConnman& connman) { cxxtimer::Timer t(true); for (const auto& sigShare : sigSharesToProcess) { auto quorumKey = std::make_pair(sigShare.getLlmqType(), sigShare.getQuorumHash()); - ProcessSigShare(sigShare, connman, quorums.at(quorumKey)); + ProcessSigShare(peerman, sigShare, connman, quorums.at(quorumKey)); } t.stop(); @@ -705,7 +708,8 @@ void CSigSharesManager::ProcessPendingSigShares(const std::vector& si } // sig shares are already verified when entering this method -void CSigSharesManager::ProcessSigShare(const CSigShare& sigShare, const CConnman& connman, const CQuorumCPtr& quorum) +void CSigSharesManager::ProcessSigShare(PeerManager& peerman, const CSigShare& sigShare, const CConnman& connman, + const CQuorumCPtr& quorum) { assert(m_mn_activeman); @@ -754,11 +758,12 @@ void CSigSharesManager::ProcessSigShare(const CSigShare& sigShare, const CConnma } if (canTryRecovery) { - TryRecoverSig(quorum, sigShare.getId(), sigShare.getMsgHash()); + TryRecoverSig(peerman, quorum, sigShare.getId(), sigShare.getMsgHash()); } } -void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash) +void CSigSharesManager::TryRecoverSig(PeerManager& peerman, const CQuorumCPtr& quorum, const uint256& id, + const uint256& msgHash) { if (sigman.HasRecoveredSigForId(quorum->params.type, id)) { return; @@ -817,7 +822,7 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256& } } - sigman.ProcessRecoveredSig(rs, *m_peerman); + sigman.ProcessRecoveredSig(rs, peerman); } CDeterministicMNCPtr CSigSharesManager::SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256 &id, int attempt) @@ -1027,7 +1032,9 @@ void CSigSharesManager::CollectSigSharesToSendConcentrated(std::unordered_map>& sigSharesToAnnounce) +void CSigSharesManager::CollectSigSharesToAnnounce( + const CConnman& connman, + std::unordered_map>& sigSharesToAnnounce) { AssertLockHeld(cs); @@ -1035,8 +1042,8 @@ void CSigSharesManager::CollectSigSharesToAnnounce(std::unordered_map> sigSharesToRequest; std::unordered_map> sigShareBatchesToSend; @@ -1113,7 +1120,7 @@ bool CSigSharesManager::SendMessages() LOCK(cs); CollectSigSharesToRequest(sigSharesToRequest); CollectSigSharesToSend(sigShareBatchesToSend); - CollectSigSharesToAnnounce(sigSharesToAnnounce); + CollectSigSharesToAnnounce(connman, sigSharesToAnnounce); CollectSigSharesToSendConcentrated(sigSharesToSend, snap.Nodes()); for (auto& [nodeId, sigShareMap] : sigSharesToRequest) { @@ -1254,7 +1261,7 @@ CSigShare CSigSharesManager::RebuildSigShare(const CSigSharesNodeState::SessionI return sigShare; } -void CSigSharesManager::Cleanup() +void CSigSharesManager::Cleanup(const CConnman& connman) { int64_t now = GetTime().count(); if (now - lastCleanupTime < 5) { @@ -1407,13 +1414,13 @@ void CSigSharesManager::RemoveSigSharesForSession(const uint256& signHash) timeSeenForSessions.erase(signHash); } -void CSigSharesManager::RemoveBannedNodeStates() +void CSigSharesManager::RemoveBannedNodeStates(PeerManager& peerman) { // Called regularly to cleanup local node states for banned nodes LOCK(cs); for (auto it = nodeStates.begin(); it != nodeStates.end();) { - if (Assert(m_peerman)->IsBanned(it->first)) { + if (peerman.IsBanned(it->first)) { // re-request sigshares from other nodes // TODO: remove NO_THREAD_SAFETY_ANALYSIS // using here template ForEach makes impossible to use lock annotation @@ -1428,23 +1435,21 @@ void CSigSharesManager::RemoveBannedNodeStates() } } -void CSigSharesManager::BanNode(NodeId nodeId) +void CSigSharesManager::BanNode(NodeId nodeId, PeerManager& peerman) { if (nodeId == -1) { return; } - { - Assert(m_peerman)->Misbehaving(nodeId, 100); - } + peerman.Misbehaving(nodeId, 100); LOCK(cs); auto it = nodeStates.find(nodeId); if (it == nodeStates.end()) { return; } - auto& nodeState = it->second; + auto& nodeState = it->second; // Whatever we requested from him, let's request it from someone else now // TODO: remove NO_THREAD_SAFETY_ANALYSIS // using here template ForEach makes impossible to use lock annotation @@ -1453,26 +1458,25 @@ void CSigSharesManager::BanNode(NodeId nodeId) sigSharesRequested.Erase(k); }); nodeState.requestedSigShares.Clear(); - nodeState.banned = true; } -void CSigSharesManager::WorkThreadMain() +void CSigSharesManager::WorkThreadMain(CConnman& connman, PeerManager& peerman) { int64_t lastSendTime = 0; while (!workInterrupt) { - RemoveBannedNodeStates(); + RemoveBannedNodeStates(peerman); - bool fMoreWork = ProcessPendingSigShares(connman); - SignPendingSigShares(); + bool fMoreWork = ProcessPendingSigShares(peerman, connman); + SignPendingSigShares(connman, peerman); if (GetTimeMillis() - lastSendTime > 100) { - SendMessages(); + SendMessages(connman); lastSendTime = GetTimeMillis(); } - Cleanup(); + Cleanup(connman); // TODO Wakeup when pending signing is needed? if (!fMoreWork && !workInterrupt.sleep_for(std::chrono::milliseconds(100))) { @@ -1487,7 +1491,7 @@ void CSigSharesManager::AsyncSign(const CQuorumCPtr& quorum, const uint256& id, pendingSigns.emplace_back(quorum, id, msgHash); } -void CSigSharesManager::SignPendingSigShares() +void CSigSharesManager::SignPendingSigShares(const CConnman& connman, PeerManager& peerman) { std::vector v; WITH_LOCK(cs_pendingSigns, v.swap(pendingSigns)); @@ -1497,7 +1501,7 @@ void CSigSharesManager::SignPendingSigShares() if (opt_sigShare.has_value() && opt_sigShare->sigShare.Get().IsValid()) { auto sigShare = *opt_sigShare; - ProcessSigShare(sigShare, connman, pQuorum); + ProcessSigShare(peerman, sigShare, connman, pQuorum); if (IsAllMembersConnectedEnabled(pQuorum->params.type, m_sporkman)) { LOCK(cs); diff --git a/src/llmq/signing_shares.h b/src/llmq/signing_shares.h index cd772b85a0b65..51e4a142d0f51 100644 --- a/src/llmq/signing_shares.h +++ b/src/llmq/signing_shares.h @@ -404,34 +404,35 @@ class CSigSharesManager : public CRecoveredSigsListener FastRandomContext rnd GUARDED_BY(cs); - CConnman& connman; CSigningManager& sigman; const CActiveMasternodeManager* const m_mn_activeman; const CQuorumManager& qman; const CSporkManager& m_sporkman; - const std::unique_ptr& m_peerman; - int64_t lastCleanupTime{0}; std::atomic recoveredSigsCounter{0}; public: - explicit CSigSharesManager(CConnman& _connman, CSigningManager& _sigman, const CActiveMasternodeManager* const mn_activeman, - const CQuorumManager& _qman, const CSporkManager& sporkman, const std::unique_ptr& peerman) : - connman(_connman), sigman(_sigman), m_mn_activeman(mn_activeman), qman(_qman), m_sporkman(sporkman), m_peerman(peerman) + explicit CSigSharesManager(CSigningManager& _sigman, const CActiveMasternodeManager* const mn_activeman, + const CQuorumManager& _qman, const CSporkManager& sporkman) : + sigman(_sigman), + m_mn_activeman(mn_activeman), + qman(_qman), + m_sporkman(sporkman) { workInterrupt.reset(); }; CSigSharesManager() = delete; ~CSigSharesManager() override = default; - void StartWorkerThread(); + void StartWorkerThread(CConnman& connman, PeerManager& peerman); void StopWorkerThread(); void RegisterAsRecoveredSigsListener(); void UnregisterAsRecoveredSigsListener(); void InterruptWorkerThread(); - void ProcessMessage(const CNode& pnode, const CSporkManager& sporkman, const std::string& msg_type, CDataStream& vRecv); + void ProcessMessage(const CNode& pnode, PeerManager& peerman, const CSporkManager& sporkman, + const std::string& msg_type, CDataStream& vRecv); void AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash); std::optional CreateSigShare(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash) const; @@ -447,7 +448,7 @@ class CSigSharesManager : public CRecoveredSigsListener bool ProcessMessageSigSharesInv(const CNode& pfrom, const CSigSharesInv& inv); bool ProcessMessageGetSigShares(const CNode& pfrom, const CSigSharesInv& inv); bool ProcessMessageBatchedSigShares(const CNode& pfrom, const CBatchedSigShares& batchedSigShares); - void ProcessMessageSigShare(NodeId fromId, const CSigShare& sigShare); + void ProcessMessageSigShare(NodeId fromId, PeerManager& peerman, const CSigShare& sigShare); static bool VerifySigSharesInv(Consensus::LLMQType llmqType, const CSigSharesInv& inv); static bool PreVerifyBatchedSigShares(const CActiveMasternodeManager& mn_activeman, const CQuorumManager& quorum_manager, @@ -456,31 +457,36 @@ class CSigSharesManager : public CRecoveredSigsListener bool CollectPendingSigSharesToVerify( size_t maxUniqueSessions, std::unordered_map>& retSigShares, std::unordered_map, CQuorumCPtr, StaticSaltedHasher>& retQuorums); - bool ProcessPendingSigShares(const CConnman& connman); + bool ProcessPendingSigShares(PeerManager& peerman, const CConnman& connman); - void ProcessPendingSigShares(const std::vector& sigSharesToProcess, - const std::unordered_map, CQuorumCPtr, StaticSaltedHasher>& quorums, - const CConnman& connman); + void ProcessPendingSigShares( + const std::vector& sigSharesToProcess, + const std::unordered_map, CQuorumCPtr, StaticSaltedHasher>& quorums, + PeerManager& peerman, const CConnman& connman); - void ProcessSigShare(const CSigShare& sigShare, const CConnman& connman, const CQuorumCPtr& quorum); - void TryRecoverSig(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash); + void ProcessSigShare(PeerManager& peerman, const CSigShare& sigShare, const CConnman& connman, + const CQuorumCPtr& quorum); + void TryRecoverSig(PeerManager& peerman, const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash); bool GetSessionInfoByRecvId(NodeId nodeId, uint32_t sessionId, CSigSharesNodeState::SessionInfo& retInfo); static CSigShare RebuildSigShare(const CSigSharesNodeState::SessionInfo& session, const std::pair& in); - void Cleanup(); + void Cleanup(const CConnman& connman); void RemoveSigSharesForSession(const uint256& signHash) EXCLUSIVE_LOCKS_REQUIRED(cs); - void RemoveBannedNodeStates(); + void RemoveBannedNodeStates(PeerManager& peerman); - void BanNode(NodeId nodeId); + void BanNode(NodeId nodeId, PeerManager& peerman); - bool SendMessages(); + bool SendMessages(CConnman& connman); void CollectSigSharesToRequest(std::unordered_map>& sigSharesToRequest) EXCLUSIVE_LOCKS_REQUIRED(cs); void CollectSigSharesToSend(std::unordered_map>& sigSharesToSend) EXCLUSIVE_LOCKS_REQUIRED(cs); void CollectSigSharesToSendConcentrated(std::unordered_map>& sigSharesToSend, const std::vector& vNodes) EXCLUSIVE_LOCKS_REQUIRED(cs); - void CollectSigSharesToAnnounce(std::unordered_map>& sigSharesToAnnounce) EXCLUSIVE_LOCKS_REQUIRED(cs); - void SignPendingSigShares(); - void WorkThreadMain(); + void CollectSigSharesToAnnounce( + const CConnman& connman, + std::unordered_map>& sigSharesToAnnounce) + EXCLUSIVE_LOCKS_REQUIRED(cs); + void SignPendingSigShares(const CConnman& connman, PeerManager& peerman); + void WorkThreadMain(CConnman& connman, PeerManager& peerman); }; } // namespace llmq diff --git a/src/net.cpp b/src/net.cpp index 45ebdafbf98f7..7c2804ed5e4ff 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -4651,13 +4651,13 @@ void CConnman::SetMasternodeQuorumRelayMembers(Consensus::LLMQType llmqType, con }); } -bool CConnman::HasMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash) +bool CConnman::HasMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash) const { LOCK(cs_vPendingMasternodes); return masternodeQuorumNodes.count(std::make_pair(llmqType, quorumHash)); } -std::set CConnman::GetMasternodeQuorums(Consensus::LLMQType llmqType) +std::set CConnman::GetMasternodeQuorums(Consensus::LLMQType llmqType) const { LOCK(cs_vPendingMasternodes); std::set result; @@ -4700,7 +4700,7 @@ void CConnman::RemoveMasternodeQuorumNodes(Consensus::LLMQType llmqType, const u masternodeQuorumRelayMembers.erase(std::make_pair(llmqType, quorumHash)); } -bool CConnman::IsMasternodeQuorumNode(const CNode* pnode, const CDeterministicMNList& tip_mn_list) +bool CConnman::IsMasternodeQuorumNode(const CNode* pnode, const CDeterministicMNList& tip_mn_list) const { // Let's see if this is an outgoing connection to an address that is known to be a masternode // We however only need to know this if the node did not authenticate itself as a MN yet diff --git a/src/net.h b/src/net.h index c0a2b82cde5f1..9085771b5335e 100644 --- a/src/net.h +++ b/src/net.h @@ -1503,12 +1503,12 @@ friend class CNode; bool AddPendingMasternode(const uint256& proTxHash); void SetMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash, const std::set& proTxHashes); void SetMasternodeQuorumRelayMembers(Consensus::LLMQType llmqType, const uint256& quorumHash, const std::set& proTxHashes); - bool HasMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash); - std::set GetMasternodeQuorums(Consensus::LLMQType llmqType); + bool HasMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash) const; + std::set GetMasternodeQuorums(Consensus::LLMQType llmqType) const; // also returns QWATCH nodes std::set GetMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash) const; void RemoveMasternodeQuorumNodes(Consensus::LLMQType llmqType, const uint256& quorumHash); - bool IsMasternodeQuorumNode(const CNode* pnode, const CDeterministicMNList& tip_mn_list); + bool IsMasternodeQuorumNode(const CNode* pnode, const CDeterministicMNList& tip_mn_list) const; bool IsMasternodeQuorumRelayMember(const uint256& protxHash); void AddPendingProbeConnections(const std::set& proTxHashes); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 193424e7b88ed..60296115358c9 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -5264,7 +5264,7 @@ void PeerManagerImpl::ProcessMessage( PostProcessMessage(m_llmq_ctx->quorum_block_processor->ProcessMessage(pfrom, msg_type, vRecv), pfrom.GetId()); ProcessPeerMsgRet(m_llmq_ctx->qdkgsman->ProcessMessage(pfrom, *this, is_masternode, msg_type, vRecv), pfrom); ProcessPeerMsgRet(m_llmq_ctx->qman->ProcessMessage(pfrom, m_connman, msg_type, vRecv), pfrom); - m_llmq_ctx->shareman->ProcessMessage(pfrom, m_sporkman, msg_type, vRecv); + m_llmq_ctx->shareman->ProcessMessage(pfrom, *this, m_sporkman, msg_type, vRecv); ProcessPeerMsgRet(m_llmq_ctx->sigman->ProcessMessage(pfrom, *this, msg_type, vRecv), pfrom); if (msg_type == NetMsgType::CLSIG) {