From 9b6e7c28d30d5f062a81ab47e9f6db61d29c19e6 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 21 Dec 2024 01:00:55 +0300 Subject: [PATCH] fix: refuse to create new clsig if we switched to a different fork while we were signing --- src/llmq/chainlocks.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/llmq/chainlocks.cpp b/src/llmq/chainlocks.cpp index 1b6f56f5c86325..463d38637d9a8e 100644 --- a/src/llmq/chainlocks.cpp +++ b/src/llmq/chainlocks.cpp @@ -519,7 +519,10 @@ MessageProcessingResult CChainLocksHandler::HandleNewRecoveredSig(const llmq::CR // already got the same or a better CLSIG through the CLSIG message return {}; } - + if (m_chainstate.m_chain.Tip()->GetAncestor(lastSignedHeight)->GetBlockHash() != lastSignedMsgHash) { + // we switched to a different fork while we were signing + return {}; + } clsig = CChainLockSig(lastSignedHeight, lastSignedMsgHash, recoveredSig.sig.Get()); }