rm onSlotStart and one level of stack calls
This commit is contained in:
parent
a52022d2ac
commit
776a131c2c
|
@ -148,24 +148,13 @@ func getBlockRef2(root: Eth2Digest): Opt[BlockRef] =
|
||||||
0.Slot)
|
0.Slot)
|
||||||
return ok(newRef)
|
return ok(newRef)
|
||||||
|
|
||||||
proc onSlotStart(node: BeaconNode, wallTime: BeaconTime,
|
|
||||||
lastSlot: Slot): Future[bool] {.async.} =
|
|
||||||
let
|
|
||||||
wallSlot = wallTime.slotOrZero
|
|
||||||
|
|
||||||
if wallSlot > 2:
|
|
||||||
quit(0)
|
|
||||||
|
|
||||||
await handleProposal(node, getBlockRef2(ZERO_HASH).get, wallSlot)
|
|
||||||
quit 0
|
|
||||||
|
|
||||||
proc start*(node: BeaconNode) {.raises: [CatchableError].} =
|
proc start*(node: BeaconNode) {.raises: [CatchableError].} =
|
||||||
echo "foo"
|
echo "foo"
|
||||||
node.elManager.start()
|
node.elManager.start()
|
||||||
let
|
let
|
||||||
wallTime = node.beaconClock.now()
|
wallTime = node.beaconClock.now()
|
||||||
|
|
||||||
asyncSpawn runSlotLoop(node, wallTime, onSlotStart)
|
asyncSpawn runSlotLoop(node, wallTime)
|
||||||
|
|
||||||
while true:
|
while true:
|
||||||
poll()
|
poll()
|
||||||
|
|
|
@ -221,8 +221,7 @@ proc sleepAsync*(t: TimeDiff): Future[void] =
|
||||||
sleepAsync(nanoseconds(
|
sleepAsync(nanoseconds(
|
||||||
if t.nanoseconds < 0: 0'i64 else: t.nanoseconds))
|
if t.nanoseconds < 0: 0'i64 else: t.nanoseconds))
|
||||||
|
|
||||||
proc runSlotLoop*[T](node: T, startTime: BeaconTime,
|
proc runSlotLoop*[T](node: T, startTime: BeaconTime) {.async.} =
|
||||||
slotProc: SlotStartProc[T]) {.async.} =
|
|
||||||
var
|
var
|
||||||
curSlot = startTime.slotOrZero()
|
curSlot = startTime.slotOrZero()
|
||||||
nextSlot = curSlot + 1 # No earlier than GENESIS_SLOT + 1
|
nextSlot = curSlot + 1 # No earlier than GENESIS_SLOT + 1
|
||||||
|
@ -252,9 +251,8 @@ proc runSlotLoop*[T](node: T, startTime: BeaconTime,
|
||||||
if wallSlot > nextSlot + SLOTS_PER_EPOCH:
|
if wallSlot > nextSlot + SLOTS_PER_EPOCH:
|
||||||
curSlot = wallSlot - SLOTS_PER_EPOCH
|
curSlot = wallSlot - SLOTS_PER_EPOCH
|
||||||
|
|
||||||
let breakLoop = await slotProc(node, wallTime, curSlot)
|
await handleProposal(node, getBlockRef2(ZERO_HASH).get, wallSlot)
|
||||||
if breakLoop:
|
quit 0
|
||||||
break
|
|
||||||
|
|
||||||
curSlot = wallSlot
|
curSlot = wallSlot
|
||||||
nextSlot = wallSlot + 1
|
nextSlot = wallSlot + 1
|
||||||
|
|
|
@ -49,7 +49,7 @@ switch("passC", "-fvisibility=hidden")
|
||||||
switch("passC", "-fno-omit-frame-pointer")
|
switch("passC", "-fno-omit-frame-pointer")
|
||||||
switch("passL", "-fno-omit-frame-pointer")
|
switch("passL", "-fno-omit-frame-pointer")
|
||||||
|
|
||||||
when false:
|
when true:
|
||||||
--define:nimStackTraceOverride
|
--define:nimStackTraceOverride
|
||||||
switch("import", "libbacktrace")
|
switch("import", "libbacktrace")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue