only show upcoming fork info if one is scheduled (#5751)
This ensures that information about the next scheduled fork is only displayed if one is actually scheduled. Current fork name is no longer shown.
This commit is contained in:
parent
3541cfe020
commit
39a2a91003
|
@ -439,8 +439,7 @@ type
|
|||
desc: "Textual template for the contents of the status bar"
|
||||
defaultValue: "peers: $connected_peers;" &
|
||||
"finalized: $finalized_root:$finalized_epoch;" &
|
||||
"head: $head_root:$head_epoch:$head_epoch_slot;" &
|
||||
"fork: $consensus_fork;" &
|
||||
"head: $head_root:$head_epoch:$head_epoch_slot$next_consensus_fork;" &
|
||||
"time: $epoch:$epoch_slot ($slot);" &
|
||||
"sync: $sync_status|" &
|
||||
"ETH: $attached_validators_balance"
|
||||
|
|
|
@ -1473,17 +1473,17 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
|
|||
|
||||
await node.updateGossipStatus(slot + 1)
|
||||
|
||||
func formatForkSchedule(node: BeaconNode): string =
|
||||
func formatNextConsensusFork(node: BeaconNode): Opt[string] =
|
||||
let consensusFork =
|
||||
node.dag.cfg.consensusForkAtEpoch(node.dag.head.slot.epoch)
|
||||
var res = $consensusFork
|
||||
if consensusFork != ConsensusFork.high:
|
||||
let
|
||||
nextConsensusFork = consensusFork.succ()
|
||||
nextForkEpoch = node.dag.cfg.consensusForkEpoch(nextConsensusFork)
|
||||
if nextForkEpoch != FAR_FUTURE_EPOCH:
|
||||
res.add " (next: " & $nextConsensusFork & ":" & $nextForkEpoch & ")"
|
||||
res
|
||||
if consensusFork == ConsensusFork.high:
|
||||
return Opt.none(string)
|
||||
let
|
||||
nextConsensusFork = consensusFork.succ()
|
||||
nextForkEpoch = node.dag.cfg.consensusForkEpoch(nextConsensusFork)
|
||||
if nextForkEpoch == FAR_FUTURE_EPOCH:
|
||||
return Opt.none(string)
|
||||
Opt.some($nextConsensusFork & ":" & $nextForkEpoch)
|
||||
|
||||
func syncStatus(node: BeaconNode, wallSlot: Slot): string =
|
||||
let optimistic_head = not node.dag.head.executionValid
|
||||
|
@ -1528,16 +1528,21 @@ proc onSlotStart(node: BeaconNode, wallTime: BeaconTime,
|
|||
|
||||
node.processingDelay = Opt.some(nanoseconds(delay.nanoseconds))
|
||||
|
||||
info "Slot start",
|
||||
slot = shortLog(wallSlot),
|
||||
epoch = shortLog(wallSlot.epoch),
|
||||
fork = node.formatForkSchedule(),
|
||||
sync = node.syncStatus(wallSlot),
|
||||
peers = len(node.network.peerPool),
|
||||
head = shortLog(node.dag.head),
|
||||
finalized = shortLog(getStateField(
|
||||
node.dag.headState, finalized_checkpoint)),
|
||||
delay = shortLog(delay)
|
||||
block:
|
||||
logScope:
|
||||
slot = shortLog(wallSlot)
|
||||
epoch = shortLog(wallSlot.epoch)
|
||||
sync = node.syncStatus(wallSlot)
|
||||
peers = len(node.network.peerPool)
|
||||
head = shortLog(node.dag.head)
|
||||
finalized = shortLog(getStateField(
|
||||
node.dag.headState, finalized_checkpoint))
|
||||
delay = shortLog(delay)
|
||||
let nextConsensusForkDescription = node.formatNextConsensusFork()
|
||||
if nextConsensusForkDescription.isNone:
|
||||
info "Slot start"
|
||||
else:
|
||||
info "Slot start", nextFork = nextConsensusForkDescription.get
|
||||
|
||||
# Check before any re-scheduling of onSlotStart()
|
||||
if checkIfShouldStopAtEpoch(wallSlot, node.config.stopAtEpoch):
|
||||
|
@ -1964,8 +1969,12 @@ when not defined(windows):
|
|||
of "attached_validators_balance":
|
||||
formatGwei(node.attachedValidatorBalanceTotal)
|
||||
|
||||
of "consensus_fork":
|
||||
node.formatForkSchedule()
|
||||
of "next_consensus_fork":
|
||||
let nextConsensusForkDescription = node.formatNextConsensusFork()
|
||||
if nextConsensusForkDescription.isNone:
|
||||
""
|
||||
else:
|
||||
" (scheduled " & nextConsensusForkDescription.get & ")"
|
||||
|
||||
of "sync_status":
|
||||
node.syncStatus(node.currentSlot)
|
||||
|
|
Loading…
Reference in New Issue