Skip to content

Commit f13b703

Browse files
committed
fix(rust/cardano-chain-follower): explicit condition for block roll forward
1 parent c3f33b4 commit f13b703

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

rust/cardano-chain-follower/src/follow.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ impl ChainFollower {
109109
}
110110
}
111111

112-
if (self.mithril_tip.is_none() || current_mithril_tip > self.mithril_tip)
113-
&& self.current < self.mithril_tip
114-
{
112+
let roll_forward_condition = if let Some(mithril_tip) = &self.mithril_tip {
113+
current_mithril_tip > *mithril_tip && *mithril_tip > self.current
114+
} else {
115+
true
116+
};
117+
118+
if roll_forward_condition {
115119
let snapshot = MithrilSnapshot::new(self.chain);
116120
if let Some(block) = snapshot.read_block_at(&current_mithril_tip).await {
117121
// The Mithril Tip has moved forwards.

0 commit comments

Comments
 (0)