mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #6175: feat: allow resigning for EHF
6f82a56171
feat: add option to AsyncSignIfMember to allow signing same requestID on different msgHashes (pasta)
Pull request description:
## Issue being fixed or feature implemented
Please see: https://www.dash.org/forum/index.php?threads/ehf-activation-issues.55146/ for a description of this issue
## What was done?
Allow re-signing specifically for EHF messages, this is important as due to rotation, and duplicate requestIDs a member will refuse to re-sign when they participate in a later quorum.
## How Has This Been Tested?
Devnet deployed with a mix of this version, older versions and current v21.0
## Breaking Changes
This doesn't introduce any breaking changes
## Checklist:
_Go over all the following points, and put an `x` in all the boxes that apply._
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
Top commit has no ACKs.
Tree-SHA512: a758e6363901624d8540983ad09085d47a33fe61e8e576ec4317b051a0f988efb983bd06d9894bcce19c9f587ad703022ce00ceddd3760d7c9d382878f40c2d7
This commit is contained in:
commit
3c6ef31816
@ -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