From 82a46db7ca4cde644a6229e0940ddc5e993dda73 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Thu, 28 Dec 2023 20:07:31 +0800 Subject: [PATCH] fix: don't sync block filter hashes if finalized checkpoint is too less than the last proved header --- src/protocols/light_client/peers.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/protocols/light_client/peers.rs b/src/protocols/light_client/peers.rs index ff04ecc..bf1dd62 100644 --- a/src/protocols/light_client/peers.rs +++ b/src/protocols/light_client/peers.rs @@ -1723,7 +1723,9 @@ impl Peers { if check_point_number == finalized_check_point_number { let proved_number = state.get_last_header().header().number(); let last_number = latest_block_filter_hashes.get_last_number(); - if last_number < proved_number { + if last_number < proved_number + && proved_number - last_number < self.check_point_interval * 2 + { Some((*peer_index, last_number + 1)) } else { None