2021-11-28 17:34:24 +00:00
|
|
|
package testutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/config/params"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/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
|
|
|
|
}
|
|
|
|
|
2023-01-26 14:40:12 +00:00
|
|
|
func (m *MockGenesisTimeFetcher) CurrentSlot() primitives.Slot {
|
|
|
|
return primitives.Slot(uint64(time.Now().Unix()-m.Genesis.Unix()) / params.BeaconConfig().SecondsPerSlot)
|
2021-11-28 17:34:24 +00:00
|
|
|
}
|