mirror of
https://github.com/wealdtech/ethdo.git
synced 2026-01-09 14:07:56 -05:00
Rework chain status output.
This commit is contained in:
@@ -85,18 +85,3 @@ func init() {
|
||||
chainCmd.AddCommand(chainInfoCmd)
|
||||
chainFlags(chainInfoCmd)
|
||||
}
|
||||
|
||||
func timestampToSlot(genesis time.Time, timestamp time.Time, secondsPerSlot time.Duration) spec.Slot {
|
||||
if timestamp.Unix() < genesis.Unix() {
|
||||
return 0
|
||||
}
|
||||
return spec.Slot(uint64(timestamp.Unix()-genesis.Unix()) / uint64(secondsPerSlot.Seconds()))
|
||||
}
|
||||
|
||||
func slotToTimestamp(genesis time.Time, slot spec.Slot, slotDuration time.Duration) int64 {
|
||||
return genesis.Unix() + int64(slot)*int64(slotDuration.Seconds())
|
||||
}
|
||||
|
||||
func epochToTimestamp(genesis time.Time, slot spec.Slot, slotDuration time.Duration, slotsPerEpoch uint64) int64 {
|
||||
return genesis.Unix() + int64(slot)*int64(slotDuration.Seconds())*int64(slotsPerEpoch)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user