mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
refactor: HandleNewRecoveredSig return PostProcessingMessage
This commit is contained in:
parent
09565fe6cc
commit
538342138c
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -829,7 +829,7 @@ void CSigningManager::ProcessRecoveredSig(const std::shared_ptr<const CRecovered
|
||||
|
||||
auto listeners = WITH_LOCK(cs_listeners, return recoveredSigsListeners);
|
||||
for (auto& l : listeners) {
|
||||
l->HandleNewRecoveredSig(*recoveredSig);
|
||||
Assert(m_peerman)->PostProcessMessage(l->HandleNewRecoveredSig(*recoveredSig));
|
||||
}
|
||||
|
||||
GetMainSignals().NotifyRecoveredSig(recoveredSig);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -432,7 +432,7 @@ public:
|
||||
std::optional<CSigShare> 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user