diff --git a/shared/slotutil/slotticker.go b/shared/slotutil/slotticker.go index 5f73bf5f9297..1318e5fba036 100644 --- a/shared/slotutil/slotticker.go +++ b/shared/slotutil/slotticker.go @@ -40,21 +40,6 @@ func GetSlotTicker(genesisTime time.Time, secondsPerSlot uint64) *SlotTicker { return ticker } -// CurrentSlot accepts the genesis time and returns the current time's slot. -func CurrentSlot( - genesisTime time.Time, - secondsPerSlot uint64, - since func(time.Time) time.Duration) uint64 { - - sinceGenesis := since(genesisTime) - if sinceGenesis < 0 { - return params.BeaconConfig().GenesisSlot - } - - durationInSeconds := time.Duration(secondsPerSlot) * time.Second - return uint64(sinceGenesis/durationInSeconds) + params.BeaconConfig().GenesisSlot -} - func (s *SlotTicker) start( genesisTime time.Time, secondsPerSlot uint64, diff --git a/shared/slotutil/slotticker_test.go b/shared/slotutil/slotticker_test.go index 7f8c2c01b824..efb387b9887d 100644 --- a/shared/slotutil/slotticker_test.go +++ b/shared/slotutil/slotticker_test.go @@ -102,20 +102,3 @@ func TestSlotTickerGenesis(t *testing.T) { t.Fatalf("Expected %d, got %d", params.BeaconConfig().GenesisSlot+1, slot) } } - -func TestCurrentSlot(t *testing.T) { - // Test genesis slot - genesisTime := time.Now() - secondsPerSlot := time.Second * time.Duration(params.BeaconConfig().SecondsPerSlot) - slot := CurrentSlot(genesisTime, params.BeaconConfig().SecondsPerSlot, time.Since) - if slot != params.BeaconConfig().GenesisSlot { - t.Errorf("Expected %d, got: %d", params.BeaconConfig().GenesisSlot, slot) - } - - // Test slot 3 after genesis. - genesisTime = genesisTime.Add(secondsPerSlot * 3) - slot = CurrentSlot(genesisTime, params.BeaconConfig().SecondsPerSlot, time.Since) - if slot != 3*params.BeaconConfig().GenesisSlot { - t.Errorf("Expected %d, got: %d", params.BeaconConfig().GenesisSlot*3, slot) - } -}