From d141f1fdd1aa93468264b87fab7b423a31fe13c1 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 21 Dec 2024 00:44:12 +0300 Subject: [PATCH] fix: refuse to create new clsig if chain tip has changed 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..663356d1a79e4a 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()->GetBlockHash() != lastSignedMsgHash) { + // chain tip has changed while we were signing + return {}; + } clsig = CChainLockSig(lastSignedHeight, lastSignedMsgHash, recoveredSig.sig.Get()); }