@@ -376,7 +376,7 @@ class CSigSharesManager : public CRecoveredSigsListener
376376 static constexpr int64_t MAX_SEND_FOR_RECOVERY_TIMEOUT{10000 };
377377 static constexpr size_t MAX_MSGS_SIG_SHARES{32 };
378378
379- RecursiveMutex cs;
379+ Mutex cs;
380380
381381 std::thread workThread;
382382 CThreadInterrupt workInterrupt;
@@ -424,73 +424,79 @@ class CSigSharesManager : public CRecoveredSigsListener
424424 const CQuorumManager& _qman, const CSporkManager& sporkman);
425425 ~CSigSharesManager () override ;
426426
427- void StartWorkerThread ();
428- void StopWorkerThread ();
429- void RegisterAsRecoveredSigsListener ();
430- void UnregisterAsRecoveredSigsListener ();
431- void InterruptWorkerThread ();
427+ void StartWorkerThread () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
428+ void StopWorkerThread () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
429+ void RegisterAsRecoveredSigsListener () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
430+ void UnregisterAsRecoveredSigsListener () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
431+ void InterruptWorkerThread () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
432432
433- void ProcessMessage (const CNode& pnode, const std::string& msg_type, CDataStream& vRecv);
433+ void ProcessMessage (const CNode& pnode, const std::string& msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
434434
435435 void AsyncSign (CQuorumCPtr quorum, const uint256& id, const uint256& msgHash)
436- EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns);
437- std::optional<CSigShare> CreateSigShare (const CQuorum& quorum, const uint256& id, const uint256& msgHash) const ;
438- void ForceReAnnouncement (const CQuorum& quorum, Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash);
436+ EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns, !cs);
437+ std::optional<CSigShare> CreateSigShare (const CQuorum& quorum, const uint256& id, const uint256& msgHash) const
438+ EXCLUSIVE_LOCKS_REQUIRED(!cs);
439+ void ForceReAnnouncement (const CQuorum& quorum, Consensus::LLMQType llmqType, const uint256& id,
440+ const uint256& msgHash) EXCLUSIVE_LOCKS_REQUIRED(!cs);
439441
440- [[nodiscard]] MessageProcessingResult HandleNewRecoveredSig (const CRecoveredSig& recoveredSig) override ;
442+ [[nodiscard]] MessageProcessingResult HandleNewRecoveredSig (const CRecoveredSig& recoveredSig) override
443+ EXCLUSIVE_LOCKS_REQUIRED(!cs);
441444
442445 static CDeterministicMNCPtr SelectMemberForRecovery (const CQuorum& quorum, const uint256& id, int attempt);
443446
444447 bool AsyncSignIfMember (Consensus::LLMQType llmqType, CSigningManager& sigman, const uint256& id,
445448 const uint256& msgHash, const uint256& quorumHash = uint256(), bool allowReSign = false,
446- bool allowDiffMsgHashSigning = false)
447- EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns);
449+ bool allowDiffMsgHashSigning = false) EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns, !cs);
448450
449- void NotifyRecoveredSig (const std::shared_ptr<const CRecoveredSig>& sig) const ;
451+ void NotifyRecoveredSig (const std::shared_ptr<const CRecoveredSig>& sig) const EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
450452
451453private:
452454 // all of these return false when the currently processed message should be aborted (as each message actually contains multiple messages)
453- bool ProcessMessageSigSesAnn (const CNode& pfrom, const CSigSesAnn& ann);
454- bool ProcessMessageSigSharesInv (const CNode& pfrom, const CSigSharesInv& inv);
455- bool ProcessMessageGetSigShares (const CNode& pfrom, const CSigSharesInv& inv);
456- bool ProcessMessageBatchedSigShares (const CNode& pfrom, const CBatchedSigShares& batchedSigShares);
457- void ProcessMessageSigShare (NodeId fromId, const CSigShare& sigShare);
455+ bool ProcessMessageSigSesAnn (const CNode& pfrom, const CSigSesAnn& ann) EXCLUSIVE_LOCKS_REQUIRED(!cs);
456+ bool ProcessMessageSigSharesInv (const CNode& pfrom, const CSigSharesInv& inv) EXCLUSIVE_LOCKS_REQUIRED(!cs);
457+ bool ProcessMessageGetSigShares (const CNode& pfrom, const CSigSharesInv& inv) EXCLUSIVE_LOCKS_REQUIRED(!cs);
458+ bool ProcessMessageBatchedSigShares (const CNode& pfrom, const CBatchedSigShares& batchedSigShares)
459+ EXCLUSIVE_LOCKS_REQUIRED(!cs);
460+ void ProcessMessageSigShare (NodeId fromId, const CSigShare& sigShare) EXCLUSIVE_LOCKS_REQUIRED(!cs);
458461
459462 static bool VerifySigSharesInv (Consensus::LLMQType llmqType, const CSigSharesInv& inv);
460463 static bool PreVerifyBatchedSigShares (const CActiveMasternodeManager& mn_activeman, const CQuorumManager& quorum_manager,
461464 const CSigSharesNodeState::SessionInfo& session, const CBatchedSigShares& batchedSigShares, bool & retBan);
462465
463466 bool CollectPendingSigSharesToVerify (
464467 size_t maxUniqueSessions, std::unordered_map<NodeId, std::vector<CSigShare>>& retSigShares,
465- std::unordered_map<std::pair<Consensus::LLMQType, uint256>, CQuorumCPtr, StaticSaltedHasher>& retQuorums);
466- bool ProcessPendingSigShares ();
468+ std::unordered_map<std::pair<Consensus::LLMQType, uint256>, CQuorumCPtr, StaticSaltedHasher>& retQuorums)
469+ EXCLUSIVE_LOCKS_REQUIRED(!cs);
470+ bool ProcessPendingSigShares () EXCLUSIVE_LOCKS_REQUIRED(!cs);
467471
468472 void ProcessPendingSigShares (
469473 const std::vector<CSigShare>& sigSharesToProcess,
470- const std::unordered_map<std::pair<Consensus::LLMQType, uint256>, CQuorumCPtr, StaticSaltedHasher>& quorums);
474+ const std::unordered_map<std::pair<Consensus::LLMQType, uint256>, CQuorumCPtr, StaticSaltedHasher>& quorums)
475+ EXCLUSIVE_LOCKS_REQUIRED(!cs);
471476
472- void ProcessSigShare (const CSigShare& sigShare, const CQuorumCPtr& quorum);
473- void TryRecoverSig (const CQuorum& quorum, const uint256& id, const uint256& msgHash);
477+ void ProcessSigShare (const CSigShare& sigShare, const CQuorumCPtr& quorum) EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
478+ void TryRecoverSig (const CQuorum& quorum, const uint256& id, const uint256& msgHash) EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
474479
475- bool GetSessionInfoByRecvId (NodeId nodeId, uint32_t sessionId, CSigSharesNodeState::SessionInfo& retInfo);
480+ bool GetSessionInfoByRecvId (NodeId nodeId, uint32_t sessionId, CSigSharesNodeState::SessionInfo& retInfo)
481+ EXCLUSIVE_LOCKS_REQUIRED(!cs);
476482 static CSigShare RebuildSigShare (const CSigSharesNodeState::SessionInfo& session, const std::pair<uint16_t , CBLSLazySignature>& in);
477483
478- void Cleanup ();
484+ void Cleanup () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
479485 void RemoveSigSharesForSession (const uint256& signHash) EXCLUSIVE_LOCKS_REQUIRED(cs);
480- void RemoveBannedNodeStates ();
486+ void RemoveBannedNodeStates () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
481487
482- void BanNode (NodeId nodeId);
488+ void BanNode (NodeId nodeId) EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
483489
484- bool SendMessages ();
490+ bool SendMessages () EXCLUSIVE_LOCKS_REQUIRED(!cs) ;
485491 void CollectSigSharesToRequest (std::unordered_map<NodeId, Uint256HashMap<CSigSharesInv>>& sigSharesToRequest)
486492 EXCLUSIVE_LOCKS_REQUIRED(cs);
487493 void CollectSigSharesToSend (std::unordered_map<NodeId, Uint256HashMap<CBatchedSigShares>>& sigSharesToSend)
488494 EXCLUSIVE_LOCKS_REQUIRED(cs);
489495 void CollectSigSharesToSendConcentrated (std::unordered_map<NodeId, std::vector<CSigShare>>& sigSharesToSend, const std::vector<CNode*>& vNodes) EXCLUSIVE_LOCKS_REQUIRED(cs);
490496 void CollectSigSharesToAnnounce (std::unordered_map<NodeId, Uint256HashMap<CSigSharesInv>>& sigSharesToAnnounce)
491497 EXCLUSIVE_LOCKS_REQUIRED(cs);
492- void SignPendingSigShares () EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns);
493- void WorkThreadMain () EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns);
498+ void SignPendingSigShares () EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns, !cs );
499+ void WorkThreadMain () EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingSigns, !cs );
494500};
495501} // namespace llmq
496502
0 commit comments