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)
|
||||
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].} =
|
||||
echo "foo"
|
||||
node.elManager.start()
|
||||
let
|
||||
wallTime = node.beaconClock.now()
|
||||
|
||||
asyncSpawn runSlotLoop(node, wallTime, onSlotStart)
|
||||
asyncSpawn runSlotLoop(node, wallTime)
|
||||
|
||||
while true:
|
||||
poll()
|
||||
|
|
|
@ -221,8 +221,7 @@ proc sleepAsync*(t: TimeDiff): Future[void] =
|
|||
sleepAsync(nanoseconds(
|
||||
if t.nanoseconds < 0: 0'i64 else: t.nanoseconds))
|
||||
|
||||
proc runSlotLoop*[T](node: T, startTime: BeaconTime,
|
||||
slotProc: SlotStartProc[T]) {.async.} =
|
||||
proc runSlotLoop*[T](node: T, startTime: BeaconTime) {.async.} =
|
||||
var
|
||||
curSlot = startTime.slotOrZero()
|
||||
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:
|
||||
curSlot = wallSlot - SLOTS_PER_EPOCH
|
||||
|
||||
let breakLoop = await slotProc(node, wallTime, curSlot)
|
||||
if breakLoop:
|
||||
break
|
||||
await handleProposal(node, getBlockRef2(ZERO_HASH).get, wallSlot)
|
||||
quit 0
|
||||
|
||||
curSlot = wallSlot
|
||||
nextSlot = wallSlot + 1
|
||||
|
|
|
@ -49,7 +49,7 @@ switch("passC", "-fvisibility=hidden")
|
|||
switch("passC", "-fno-omit-frame-pointer")
|
||||
switch("passL", "-fno-omit-frame-pointer")
|
||||
|
||||
when false:
|
||||
when true:
|
||||
--define:nimStackTraceOverride
|
||||
switch("import", "libbacktrace")
|
||||
|
||||
|
|
Loading…
Reference in New Issue