Skip to content

Commit 04a51c9

Browse files
committed
Use a block that is 8 blocks in the past for SelectQuorumForSigning
Otherwise nodes might already fail to verify sigs when just 1 block away from the tip.
1 parent cf33efc commit 04a51c9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/llmq/quorums_signing.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ CQuorumCPtr CSigningManager::SelectQuorumForSigning(Consensus::LLMQType llmqType
565565
if (signHeight > chainActive.Height()) {
566566
return nullptr;
567567
}
568-
startBlock = chainActive[signHeight]->GetBlockHash();
568+
startBlock = chainActive[signHeight - SIGN_HEIGHT_OFFSET]->GetBlockHash();
569569
}
570570

571571
auto quorums = quorumManager->ScanQuorums(llmqType, startBlock, poolSize);

src/llmq/quorums_signing.h

+5
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ class CSigningManager
104104
friend class CSigSharesManager;
105105
static const int64_t DEFAULT_MAX_RECOVERED_SIGS_AGE = 60 * 60 * 24 * 7; // keep them for a week
106106

107+
// when selecting a quorum for signing and verification, we use CQuorumManager::SelectQuorum with this offset as
108+
// starting height for scanning. This is because otherwise the resulting signatures would not be verifiable by nodes
109+
// which are not 100% at the chain tip.
110+
static const int SIGN_HEIGHT_OFFSET = 8;
111+
107112
private:
108113
CCriticalSection cs;
109114

0 commit comments

Comments
 (0)