diff --git a/src/llmq/chainlocks.cpp b/src/llmq/chainlocks.cpp index 36c8ce83c1..e46b3bd7f5 100644 --- a/src/llmq/chainlocks.cpp +++ b/src/llmq/chainlocks.cpp @@ -525,10 +525,10 @@ void CChainLocksHandler::EnforceBestChainLock() uiInterface.NotifyChainLock(clsig->getBlockHash().ToString(), clsig->getHeight()); } -void CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig) +MessageProcessingResult CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig) { if (!isEnabled) { - return; + return {}; } CChainLockSig clsig; @@ -537,17 +537,18 @@ void CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recove if (recoveredSig.getId() != lastSignedRequestId || recoveredSig.getMsgHash() != lastSignedMsgHash) { // this is not what we signed, so lets not create a CLSIG for it - return; + return {}; } if (bestChainLock.getHeight() >= lastSignedHeight) { // already got the same or a better CLSIG through the CLSIG message - return; + return {}; } clsig = CChainLockSig(lastSignedHeight, lastSignedMsgHash, recoveredSig.sig.Get()); } ProcessNewChainLock(-1, clsig, ::SerializeHash(clsig)); + return {}; } bool CChainLocksHandler::HasChainLock(int nHeight, const uint256& blockHash) const diff --git a/src/llmq/chainlocks.h b/src/llmq/chainlocks.h index 3cfc7ce801..7a7682fa47 100644 --- a/src/llmq/chainlocks.h +++ b/src/llmq/chainlocks.h @@ -111,7 +111,7 @@ public: void CheckActiveState() EXCLUSIVE_LOCKS_REQUIRED(!cs); void TrySignChainTip() EXCLUSIVE_LOCKS_REQUIRED(!cs); void EnforceBestChainLock() EXCLUSIVE_LOCKS_REQUIRED(!cs); - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override EXCLUSIVE_LOCKS_REQUIRED(!cs); + [[nodiscard]] MessageProcessingResult HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override EXCLUSIVE_LOCKS_REQUIRED(!cs); bool HasChainLock(int nHeight, const uint256& blockHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs); bool HasConflictingChainLock(int nHeight, const uint256& blockHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs); diff --git a/src/llmq/ehf_signals.cpp b/src/llmq/ehf_signals.cpp index b5ec7a1e33..f9f08eb896 100644 --- a/src/llmq/ehf_signals.cpp +++ b/src/llmq/ehf_signals.cpp @@ -94,7 +94,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind sigman.AsyncSignIfMember(llmqType, shareman, requestId, msgHash, quorum->qc->quorumHash, false, true); } -void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) +MessageProcessingResult CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) { if (g_txindex) { g_txindex->BlockUntilSyncedToCurrentChain(); @@ -102,7 +102,7 @@ void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig if (WITH_LOCK(cs, return ids.find(recoveredSig.getId()) == ids.end())) { // Do nothing, it's not for this handler - return; + return {}; } const auto ehfSignals = mnhfman.GetSignalsStage(WITH_LOCK(cs_main, return chainstate.m_chain.Tip())); @@ -137,5 +137,6 @@ void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig } break; } + return {}; } } // namespace llmq diff --git a/src/llmq/ehf_signals.h b/src/llmq/ehf_signals.h index 22a01cf3fe..a77c7b8266 100644 --- a/src/llmq/ehf_signals.h +++ b/src/llmq/ehf_signals.h @@ -49,7 +49,8 @@ public: */ void UpdatedBlockTip(const CBlockIndex* const pindexNew, bool is_masternode) EXCLUSIVE_LOCKS_REQUIRED(!cs); - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override EXCLUSIVE_LOCKS_REQUIRED(!cs); + [[nodiscard]] MessageProcessingResult HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override + EXCLUSIVE_LOCKS_REQUIRED(!cs); private: void trySignEHFSignal(int bit, const CBlockIndex* const pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs); diff --git a/src/llmq/instantsend.cpp b/src/llmq/instantsend.cpp index 2d3b988332..713e874be5 100644 --- a/src/llmq/instantsend.cpp +++ b/src/llmq/instantsend.cpp @@ -622,14 +622,14 @@ bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebu return true; } -void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) +MessageProcessingResult CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) { if (!IsInstantSendEnabled()) { - return; + return {}; } if (Params().GetConsensus().llmqTypeDIP0024InstantSend == Consensus::LLMQType::LLMQ_NONE) { - return; + return {}; } uint256 txid; @@ -641,6 +641,7 @@ void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSi } else if (/*isInstantSendLock=*/ WITH_LOCK(cs_creating, return creatingInstantSendLocks.count(recoveredSig.getId()))) { HandleNewInstantSendLockRecoveredSig(recoveredSig); } + return {}; } void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid) diff --git a/src/llmq/instantsend.h b/src/llmq/instantsend.h index 196d7ab25b..d08522436f 100644 --- a/src/llmq/instantsend.h +++ b/src/llmq/instantsend.h @@ -330,7 +330,7 @@ public: bool IsWaitingForTx(const uint256& txHash) const EXCLUSIVE_LOCKS_REQUIRED(!cs_pendingLocks); CInstantSendLockPtr GetConflictingLock(const CTransaction& tx) const; - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override + [[nodiscard]] MessageProcessingResult HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests, !cs_pendingLocks); PeerMsgRet ProcessMessage(const CNode& pfrom, std::string_view msg_type, CDataStream& vRecv); diff --git a/src/llmq/signing.cpp b/src/llmq/signing.cpp index e04f924ba4..c31ef78039 100644 --- a/src/llmq/signing.cpp +++ b/src/llmq/signing.cpp @@ -829,7 +829,7 @@ void CSigningManager::ProcessRecoveredSig(const std::shared_ptrHandleNewRecoveredSig(*recoveredSig); + Assert(m_peerman)->PostProcessMessage(l->HandleNewRecoveredSig(*recoveredSig)); } GetMainSignals().NotifyRecoveredSig(recoveredSig); diff --git a/src/llmq/signing.h b/src/llmq/signing.h index 562e533b2f..540157f347 100644 --- a/src/llmq/signing.h +++ b/src/llmq/signing.h @@ -154,7 +154,7 @@ class CRecoveredSigsListener public: virtual ~CRecoveredSigsListener() = default; - virtual void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) = 0; + [[nodiscard]] virtual MessageProcessingResult HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) = 0; }; class CSigningManager diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index da63536c99..0b157f218a 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -1553,10 +1553,11 @@ void CSigSharesManager::ForceReAnnouncement(const CQuorumCPtr& quorum, Consensus } } -void CSigSharesManager::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig) +MessageProcessingResult CSigSharesManager::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig) { LOCK(cs); RemoveSigSharesForSession(recoveredSig.buildSignHash()); + return {}; } } // namespace llmq diff --git a/src/llmq/signing_shares.h b/src/llmq/signing_shares.h index b1f0acbf31..9f6d8a2e6b 100644 --- a/src/llmq/signing_shares.h +++ b/src/llmq/signing_shares.h @@ -432,7 +432,7 @@ public: std::optional CreateSigShare(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash) const; void ForceReAnnouncement(const CQuorumCPtr& quorum, Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash); - void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override; + [[nodiscard]] MessageProcessingResult HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override; static CDeterministicMNCPtr SelectMemberForRecovery(const CQuorumCPtr& quorum, const uint256& id, int attempt);