From f3d4bd1e6ce8de8a5fb2b5536275b21d4e088f89 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Fri, 29 Dec 2023 22:49:14 +0800 Subject: [PATCH] fix: refresh last state even no proved state --- src/protocols/light_client/peers.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/protocols/light_client/peers.rs b/src/protocols/light_client/peers.rs index bf1dd62..8b3162f 100644 --- a/src/protocols/light_client/peers.rs +++ b/src/protocols/light_client/peers.rs @@ -1025,9 +1025,10 @@ impl PeerState { fn require_new_last_state(&self, before_ts: u64) -> bool { match self { Self::Initialized => true, - Self::Ready { ref last_state, .. } => last_state.update_ts < before_ts, - Self::OnlyHasLastState { .. } - | Self::RequestFirstLastState { .. } + Self::OnlyHasLastState { ref last_state } | Self::Ready { ref last_state, .. } => { + last_state.update_ts < before_ts + } + Self::RequestFirstLastState { .. } | Self::RequestFirstLastStateProof { .. } | Self::RequestNewLastState { .. } | Self::RequestNewLastStateProof { .. } => false,