Skip to content

Commit 3c6ef31

Browse files
Merge #6175: feat: allow resigning for EHF
6f82a56 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
2 parents 4f406bc + 6f82a56 commit 3c6ef31

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/llmq/ehf_signals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
9393
const uint256 msgHash = mnhfPayload.PrepareTx().GetHash();
9494

9595
WITH_LOCK(cs, ids.insert(requestId));
96-
sigman.AsyncSignIfMember(llmqType, shareman, requestId, msgHash);
96+
sigman.AsyncSignIfMember(llmqType, shareman, requestId, msgHash, quorum->qc->quorumHash, false, true);
9797
}
9898

9999
void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig)

src/llmq/signing.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,9 @@ void CSigningManager::UnregisterRecoveredSigsListener(CRecoveredSigsListener* l)
876876
recoveredSigsListeners.erase(itRem, recoveredSigsListeners.end());
877877
}
878878

879-
bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id, const uint256& msgHash, const uint256& quorumHash, bool allowReSign)
879+
bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id,
880+
const uint256& msgHash, const uint256& quorumHash, bool allowReSign,
881+
bool allowDiffMsgHashSigning)
880882
{
881883
if (m_mn_activeman == nullptr) return false;
882884
if (m_mn_activeman->GetProTxHash().IsNull()) return false;
@@ -911,9 +913,15 @@ bool CSigningManager::AsyncSignIfMember(Consensus::LLMQType llmqType, CSigShares
911913
uint256 prevMsgHash;
912914
db.GetVoteForId(llmqType, id, prevMsgHash);
913915
if (msgHash != prevMsgHash) {
914-
LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Not voting on conflicting msgHash=%s\n", __func__,
915-
id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
916-
return false;
916+
if (allowDiffMsgHashSigning) {
917+
LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Signing for different msgHash=%s\n",
918+
__func__, id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
919+
hasVoted = false;
920+
} else {
921+
LogPrintf("CSigningManager::%s -- already voted for id=%s and msgHash=%s. Not voting on conflicting msgHash=%s\n",
922+
__func__, id.ToString(), prevMsgHash.ToString(), msgHash.ToString());
923+
return false;
924+
}
917925
} else if (allowReSign) {
918926
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- already voted for id=%s and msgHash=%s. Resigning!\n", __func__,
919927
id.ToString(), prevMsgHash.ToString());

src/llmq/signing.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ class CSigningManager
218218
void RegisterRecoveredSigsListener(CRecoveredSigsListener* l);
219219
void UnregisterRecoveredSigsListener(CRecoveredSigsListener* l);
220220

221-
bool AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id, const uint256& msgHash, const uint256& quorumHash = uint256(), bool allowReSign = false);
221+
bool AsyncSignIfMember(Consensus::LLMQType llmqType, CSigSharesManager& shareman, const uint256& id,
222+
const uint256& msgHash, const uint256& quorumHash = uint256(), bool allowReSign = false,
223+
bool allowDiffMsgHashSigning = false);
222224
bool HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash) const;
223225
bool HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id) const;
224226
bool HasRecoveredSigForSession(const uint256& signHash) const;

0 commit comments

Comments
 (0)