diff --git a/rust/cardano-chain-follower/examples/follow_chains.rs b/rust/cardano-chain-follower/examples/follow_chains.rs index ce1750be82..bc60dc5ec4 100644 --- a/rust/cardano-chain-follower/examples/follow_chains.rs +++ b/rust/cardano-chain-follower/examples/follow_chains.rs @@ -111,7 +111,7 @@ async fn start_sync_for(network: &Network, matches: ArgMatches) -> Result<(), Bo mithril_dl_connect_timeout = format!("{}", humantime::format_duration(connect_timeout)); } - if let Some(data_timeout) = matches.get_one::("mithril-sync-data-timeout") { + if let Some(data_timeout) = matches.get_one::("mithril-sync-data-read-timeout") { dl_config = dl_config.with_connection_timeout(Duration::from_secs(*data_timeout)); } if let Some(data_timeout) = dl_config.data_read_timeout { diff --git a/rust/cardano-chain-follower/src/follow.rs b/rust/cardano-chain-follower/src/follow.rs index fc8c1ce348..95972ce230 100644 --- a/rust/cardano-chain-follower/src/follow.rs +++ b/rust/cardano-chain-follower/src/follow.rs @@ -109,9 +109,13 @@ impl ChainFollower { } } - if (self.mithril_tip.is_none() || current_mithril_tip > self.mithril_tip) - && self.current < self.mithril_tip - { + let roll_forward_condition = if let Some(mithril_tip) = &self.mithril_tip { + current_mithril_tip > *mithril_tip && *mithril_tip > self.current + } else { + true + }; + + if roll_forward_condition { let snapshot = MithrilSnapshot::new(self.chain); if let Some(block) = snapshot.read_block_at(¤t_mithril_tip).await { // The Mithril Tip has moved forwards.