Skip to content

Commit 0fc0bec

Browse files
committed
fix: refuse to create new clsig if we switched to a different fork while we were signing
1 parent dd96032 commit 0fc0bec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/llmq/chainlocks.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,11 @@ MessageProcessingResult CChainLocksHandler::HandleNewRecoveredSig(const llmq::CR
519519
// already got the same or a better CLSIG through the CLSIG message
520520
return {};
521521
}
522-
522+
const auto pindex = m_chainstate.m_chain.Tip()->GetAncestor(lastSignedHeight);
523+
if (pindex == nullptr || pindex->GetBlockHash() != lastSignedMsgHash) {
524+
// we switched to a different fork while we were signing
525+
return {};
526+
}
523527

524528
clsig = CChainLockSig(lastSignedHeight, lastSignedMsgHash, recoveredSig.sig.Get());
525529
}

0 commit comments

Comments
 (0)