Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/llmq/instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,11 @@ std::unordered_set<uint256, StaticSaltedHasher> CInstantSendManager::ProcessPend
if (blockIndex->nHeight + dkgInterval < m_chainstate.m_chain.Height()) {
nSignHeight = blockIndex->nHeight + dkgInterval - 1;
}
// For RegTest non-rotating quorum cycleHash has directly quorum hash
auto quorum = llmq_params.useRotation ? llmq::SelectQuorumForSigning(llmq_params, m_chainstate.m_chain, qman,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SelectQuorumForSigning should handle this internally already

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should handle this internally, but somehow SelectQuorumForSigning returns sometimes is not exactly same quorum -> validation fails (see logs):

 node0 2025-06-19T14:49:28.463903Z (mocktime: 2014-12-12T05:56:41Z) [     isman] [llmq/instantsend.cpp:957] [ProcessPendingInstantSendLocks] [instantsend] CInstantSendManager::ProcessPendingInstantSendLocks -- verified locks. count=1, alreadyVerified=0, vt=4, nodes=1 
 node0 2025-06-19T14:49:28.463934Z (mocktime: 2014-12-12T05:56:41Z) [     isman] [llmq/instantsend.cpp:976] [ProcessPendingInstantSendLocks] [instantsend] CInstantSendManager::ProcessPendingInstantSendLocks -- txid=11fe72d9be3c2fe4a2545429ed88c20928e21ece77de896423dbbb55fe00679d, islock=527c905af5e2f8d7e7be84e57c19ae6fe22b37bcc96735d475c21f1f9ce57927: invalid sig in islock, peer=1 
 node0 2025-06-19T14:49:28.463951Z (mocktime: 2014-12-12T05:56:41Z) [     isman] [llmq/instantsend.cpp:876] [ProcessPendingInstantSendLocks] [instantsend] CInstantSendManager::ProcessPendingInstantSendLocks -- doing verification on old active set 
 node0 2025-06-19T14:49:28.468400Z (mocktime: 2014-12-12T05:56:41Z) [     isman] [llmq/instantsend.cpp:957] [ProcessPendingInstantSendLocks] [instantsend] CInstantSendManager::ProcessPendingInstantSendLocks -- verified locks. count=1, alreadyVerified=0, vt=4, nodes=1 
 node0 2025-06-19T14:49:28.468436Z (mocktime: 2014-12-12T05:56:41Z) [     isman] [net_processing.cpp:1799] [Misbehaving] [net] Misbehaving: peer=1 (0 -> 20) 
 node0 2025-06-19T14:49:28.468448Z (mocktime: 2014-12-12T05:56:41Z) [     isman] [llmq/instantsend.cpp:976] [ProcessPendingInstantSendLocks] [instantsend] CInstantSendManager::ProcessPendingInstantSendLocks -- txid=11fe72d9be3c2fe4a2545429ed88c20928e21ece77de896423dbbb55fe00679d, islock=527c905af5e2f8d7e7be84e57c19ae6fe22b37bcc96735d475c21f1f9ce57927: invalid sig in islock, peer=1

invalid sig in islock is caused by wrong value signHash (I added extra logs while investigation issue) and that happens due to wrong quorum->qc->quorumHash.

I can not figure what exactly causes indeterminism in SelectQuorumForSigning, but this fix is quite reliable on my localhost (5-10% failures vs ~0% failures with the exactly same log message)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like nSignHeight adjustment above works with rotating quorums only. These calculations could be tweaked to work with non-rotating quorums too I guess but I like simply using GetQuorum instead.

id, nSignHeight, signOffset)
: qman.GetQuorum(llmq_params.type, islock->cycleHash);

auto quorum = llmq::SelectQuorumForSigning(llmq_params, m_chainstate.m_chain, qman, id, nSignHeight, signOffset);
if (!quorum) {
// should not happen, but if one fails to select, all others will also fail to select
return {};
Expand Down
Loading