Use current slot helper whenever possible (#15301)

This commit is contained in:
terence
2025-05-18 09:06:54 -07:00
committed by GitHub
parent f02955676b
commit c1b99b74c7
4 changed files with 6 additions and 7 deletions

View File

@@ -21,7 +21,6 @@ import (
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
validatorpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1/validator-client"
"github.com/OffchainLabs/prysm/v6/runtime/version"
prysmTime "github.com/OffchainLabs/prysm/v6/time"
"github.com/OffchainLabs/prysm/v6/time/slots"
"github.com/OffchainLabs/prysm/v6/validator/client/iface"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -320,8 +319,7 @@ func ProposeExit(
}
func CurrentEpoch(genesisTime *timestamp.Timestamp) (primitives.Epoch, error) {
totalSecondsPassed := prysmTime.Now().Unix() - genesisTime.Seconds
currentSlot := primitives.Slot((uint64(totalSecondsPassed)) / params.BeaconConfig().SecondsPerSlot)
currentSlot := slots.CurrentSlot(uint64(genesisTime.Seconds))
currentEpoch := slots.ToEpoch(currentSlot)
return currentEpoch, nil
}