prysm-pulse/beacon-chain/rpc/testutil/mock_genesis_timefetcher.go
Radosław Kapka 77d3ccb9ad
Clean up state types (#11916)
* Clean up state types

* rename package
2023-01-26 14:40:12 +00:00

22 lines
548 B
Go

package testutil
import (
"time"
"github.com/prysmaticlabs/prysm/v3/config/params"
"github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
)
// MockGenesisTimeFetcher is a fake implementation of the blockchain.TimeFetcher
type MockGenesisTimeFetcher struct {
Genesis time.Time
}
func (m *MockGenesisTimeFetcher) GenesisTime() time.Time {
return m.Genesis
}
func (m *MockGenesisTimeFetcher) CurrentSlot() primitives.Slot {
return primitives.Slot(uint64(time.Now().Unix()-m.Genesis.Unix()) / params.BeaconConfig().SecondsPerSlot)
}