mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
feat: add option to AsyncSignIfMember to allow signing same requestID on different msgHashes
This commit is contained in:
parent
58f703247b
commit
6f82a56171
@ -93,7 +93,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
|
||||
const uint256 msgHash = mnhfPayload.PrepareTx().GetHash();
|
||||
|
||||
WITH_LOCK(cs, ids.insert(requestId));
|
||||
sigman.AsyncSignIfMember(llmqType, shareman, requestId, msgHash);
|
||||
sigman.AsyncSignIfMember(llmqType, shareman, requestId, msgHash, quorum->qc->quorumHash, false, true);
|
||||
}
|
||||
|
||||
void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig)
|
||||
|
@ -876,7 +876,9 @@ void CSigningManager::UnregisterRecoveredSigsListener(CRecoveredSigsListener* l)
|
||||
recoveredSigsListeners.erase(itRem, recoveredSigsListeners.end());
|
||||
}
|
||||
|
||||
bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id, const uint256& msgHash, const uint256& quorumHash, bool allowReSign)
|
||||
bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id,
|
||||
const uint256& msgHash, const uint256& quorumHash, bool allowReSign,
|
||||
bool allowDiffMsgHashSigning)
|
||||
{
|
||||
if (m_mn_activeman == nullptr) return false;
|
||||
if (m_mn_activeman->GetProTxHash().IsNull()) return false;
|
||||
@ -911,9 +913,15 @@ bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigShares
|
||||
uint256 prevMsgHash;
|
||||
db.GetVoteForId(llmqType, id, prevMsgHash);
|
||||
if (msgHash != prevMsgHash) {
|
||||
LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Not voting on conflicting msgHash=%s\n", __func__,
|
||||
id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
|
||||
return false;
|
||||
if (allowDiffMsgHashSigning) {
|
||||
LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Signing for different msgHash=%s\n",
|
||||
__func__, id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
|
||||
hasVoted = false;
|
||||
} else {
|
||||
LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Not voting on conflicting msgHash=%s\n",
|
||||
__func__, id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
|
||||
return false;
|
||||
}
|
||||
} else if (allowReSign) {
|
||||
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- already voted for id=%s and msgHash=%s. Resigning!\n", __func__,
|
||||
id.ToString(), prevMsgHash.ToString());
|
||||
|
@ -218,7 +218,9 @@ public:
|
||||
void RegisterRecoveredSigsListener(CRecoveredSigsListener* l);
|
||||
void UnregisterRecoveredSigsListener(CRecoveredSigsListener* l);
|
||||
|
||||
bool AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id, const uint256& msgHash, const uint256& quorumHash = uint256(), bool allowReSign = false);
|
||||
bool AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id,
|
||||
const uint256& msgHash, const uint256& quorumHash = uint256(), bool allowReSign = false,
|
||||
bool allowDiffMsgHashSigning = false);
|
||||
bool HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash) const;
|
||||
bool HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id) const;
|
||||
bool HasRecoveredSigForSession(const uint256& signHash) const;
|
||||
|
Loading…
Reference in New Issue
Block a user