Skip to content

Commit c6e912e

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

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ 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 rollforward_condition = if let Some(mithril_tip) = &self.mithril_tip {
113+
current_mithril_tip > *mithril_tip && *mithril_tip > self.current
114+
} else { true };
115+
116+
if rollforward_condition {
115117
let snapshot = MithrilSnapshot::new(self.chain);
116118
if let Some(block) = snapshot.read_block_at(&current_mithril_tip).await {
117119
// The Mithril Tip has moved forwards.

0 commit comments

Comments
 (0)