File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
rust/cardano-blockchain-types/src Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -185,16 +185,25 @@ impl Network {
185185 return None ;
186186 }
187187
188- let elapsed_slots = if time < shelley_start_time {
188+ let ( elapsed_slots, era_known_slot ) = if time < shelley_start_time {
189189 // Byron era
190190 let time_diff = time - byron_start_time;
191- time_diff. num_seconds ( ) / i64:: from ( genesis. byron_slot_length )
191+ (
192+ time_diff. num_seconds ( ) / i64:: from ( genesis. byron_slot_length ) ,
193+ genesis. byron_known_slot ,
194+ )
192195 } else {
193196 // Shelley era
194197 let time_diff = time - shelley_start_time;
195- time_diff. num_seconds ( ) / i64:: from ( genesis. shelley_slot_length )
198+ (
199+ time_diff. num_seconds ( ) / i64:: from ( genesis. shelley_slot_length ) ,
200+ genesis. shelley_known_slot ,
201+ )
196202 } ;
197- Some ( Slot :: from_saturating ( elapsed_slots) )
203+
204+ let era_known_slot = i64:: try_from ( era_known_slot) . ok ( ) ?;
205+
206+ Some ( Slot :: from_saturating ( elapsed_slots + era_known_slot) )
198207 }
199208}
200209
You can’t perform that action at this time.
0 commit comments