Skip to content

Commit 4a4354d

Browse files
committed
chore: fmtfix
1 parent 0602cee commit 4a4354d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,8 @@ impl Network {
174174
let genesis = self.genesis_values();
175175

176176
let byron_start_time = DateTime::<Utc>::from_timestamp(genesis.byron_known_time as i64, 0)?;
177-
let byron_slot_length = genesis.byron_slot_length as i64;
178-
179-
let shelley_start_time = DateTime::<Utc>::from_timestamp(genesis.shelley_known_time as i64, 0)?;
180-
let shelley_slot_length = genesis.shelley_slot_length as i64;
177+
let shelley_start_time =
178+
DateTime::<Utc>::from_timestamp(genesis.shelley_known_time as i64, 0)?;
181179

182180
// determine if the given time is in Byron or Shelley era.
183181
if time < byron_start_time {
@@ -187,12 +185,12 @@ impl Network {
187185
if time < shelley_start_time {
188186
// Byron era
189187
let time_diff = time - byron_start_time;
190-
let elapsed_slots = time_diff.num_seconds() / byron_slot_length;
188+
let elapsed_slots = time_diff.num_seconds() / i64::from(genesis.byron_slot_length);
191189
Some(genesis.byron_known_slot + elapsed_slots as u64)
192190
} else {
193191
// Shelley era
194192
let time_diff = time - shelley_start_time;
195-
let elapsed_slots = time_diff.num_seconds() / shelley_slot_length;
193+
let elapsed_slots = time_diff.num_seconds() / i64::from(genesis.shelley_slot_length);
196194
Some(genesis.shelley_known_slot + elapsed_slots as u64)
197195
}
198196
}

0 commit comments

Comments
 (0)