From af0b0557d17e9d9dc5a697cfc28c5405686131ab Mon Sep 17 00:00:00 2001 From: Balaji Arun Date: Thu, 21 Nov 2024 16:22:21 -0800 Subject: [PATCH] [consensus] trigger sync based on remote LI timestamp --- consensus/src/block_storage/sync_manager.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/consensus/src/block_storage/sync_manager.rs b/consensus/src/block_storage/sync_manager.rs index 07b20edf8a922..3f9e917479bad 100644 --- a/consensus/src/block_storage/sync_manager.rs +++ b/consensus/src/block_storage/sync_manager.rs @@ -68,6 +68,13 @@ impl BlockStore { && !self.block_exists(li.commit_info().id())) || self.commit_root().round() + 30.max(2 * self.vote_back_pressure_limit) < li.commit_info().round() + // If the LI commit block timestamp is more than 30 secs ahead of self commit block + // timestamp, sync to the ledger info + || li + .commit_info() + .timestamp_usecs() + .saturating_sub(self.commit_root().timestamp_usecs()) + >= Duration::from_secs(30).as_micros() as u64 } /// Checks if quorum certificate can be inserted in block store without RPC