From 26fee3a7bcf329d2c2f0285f4885c6f1da5fb78c Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 19 Dec 2023 23:13:40 +0300 Subject: [PATCH] fix: do not process clsigs while node is still syncing --- src/llmq/chainlocks.cpp | 5 +++++ test/functional/feature_llmq_chainlocks.py | 1 + 2 files changed, 6 insertions(+) diff --git a/src/llmq/chainlocks.cpp b/src/llmq/chainlocks.cpp index ae1be6f172678..889237e294fa1 100644 --- a/src/llmq/chainlocks.cpp +++ b/src/llmq/chainlocks.cpp @@ -107,6 +107,11 @@ void CChainLocksHandler::ProcessMessage(const CNode& pfrom, const std::string& m void CChainLocksHandler::ProcessNewChainLock(const NodeId from, const llmq::CChainLockSig& clsig, const uint256& hash) { + if (!m_mn_sync.IsBlockchainSynced()) { + // too early to do anything + return; + } + CheckActiveState(); CInv clsigInv(MSG_CLSIG, hash); diff --git a/test/functional/feature_llmq_chainlocks.py b/test/functional/feature_llmq_chainlocks.py index 147b04d3a8d68..6428f72226c68 100755 --- a/test/functional/feature_llmq_chainlocks.py +++ b/test/functional/feature_llmq_chainlocks.py @@ -156,6 +156,7 @@ def run_test(self): self.log.info("Restart it so that it forgets all the chainlock messages from the past") self.restart_node(0) self.connect_nodes(0, 1) + force_finish_mnsync(self.nodes[0]) assert self.nodes[0].getbestblockhash() == good_tip self.nodes[0].invalidateblock(good_tip) self.log.info("Now try to reorg the chain")