mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
Better start-up logic when the beacon node is launched before the genesis time
This commit is contained in:
parent
78f7a4a505
commit
74f630eb28
@ -720,10 +720,9 @@ proc run*(node: BeaconNode) =
|
||||
node.onAttestation(attestation)
|
||||
|
||||
let
|
||||
wallSlot = node.beaconClock.now().toSlot()
|
||||
startSlot =
|
||||
if wallSlot.afterGenesis: wallSlot.slot + 1
|
||||
else: GENESIS_SLOT + 1
|
||||
t = node.beaconClock.now()
|
||||
startSlot = if t > BeaconTime(0): t.toSlot + 1
|
||||
else: GENESIS_SLOT + 1
|
||||
fromNow = saturate(node.beaconClock.fromNow(startSlot))
|
||||
|
||||
info "Scheduling first slot action",
|
||||
|
@ -38,6 +38,12 @@ proc init*(T: type BeaconClock, state: BeaconState): T =
|
||||
|
||||
T(genesis: unixGenesis - unixGenesisOffset)
|
||||
|
||||
template `<`*(a, b: BeaconTime): bool =
|
||||
int64(a) < int64(b)
|
||||
|
||||
template `<=`*(a, b: BeaconTime): bool =
|
||||
int64(a) <= int64(b)
|
||||
|
||||
func toSlot*(t: BeaconTime): tuple[afterGenesis: bool, slot: Slot] =
|
||||
let ti = t.int64
|
||||
if ti >= 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user