2021-11-28 17:34:24 +00:00
|
|
|
package testutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2022-08-16 12:20:13 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v3/config/params"
|
|
|
|
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
|
2021-11-28 17:34:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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() types.Slot {
|
|
|
|
return types.Slot(uint64(time.Now().Unix()-m.Genesis.Unix()) / params.BeaconConfig().SecondsPerSlot)
|
|
|
|
}
|