This commit is contained in:
Eugene Kabanov 2022-08-17 01:14:32 +03:00 committed by GitHub
parent e732b080f7
commit cd9b50bbbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,14 +184,27 @@ proc checkSync(vc: ValidatorClientRef,
return return
node.syncInfo = some(syncInfo) node.syncInfo = some(syncInfo)
node.status = node.status =
if not(syncInfo.is_syncing) or (syncInfo.sync_distance < SYNC_TOLERANCE): block:
info "Beacon node is in sync", sync_distance = syncInfo.sync_distance, let optimistic =
head_slot = syncInfo.head_slot if syncInfo.is_optimistic.isNone():
RestBeaconNodeStatus.Online "none"
else: else:
warn "Beacon node not in sync", sync_distance = syncInfo.sync_distance, $syncInfo.is_optimistic.get()
head_slot = syncInfo.head_slot
RestBeaconNodeStatus.NotSynced if not(syncInfo.is_syncing) or (syncInfo.sync_distance < SYNC_TOLERANCE):
if not(syncInfo.is_optimistic.get(false)):
info "Beacon node is in sync", sync_distance = syncInfo.sync_distance,
head_slot = syncInfo.head_slot, is_opimistic = optimistic
RestBeaconNodeStatus.Online
else:
warn "Beacon node is optimistically synced only",
sync_distance = syncInfo.sync_distance,
head_slot = syncInfo.head_slot, is_opimistic = optimistic
RestBeaconNodeStatus.NotSynced
else:
warn "Beacon node not in sync", sync_distance = syncInfo.sync_distance,
head_slot = syncInfo.head_slot, is_opimistic = optimistic
RestBeaconNodeStatus.NotSynced
proc checkOnline(node: BeaconNodeServerRef) {.async.} = proc checkOnline(node: BeaconNodeServerRef) {.async.} =
logScope: endpoint = node logScope: endpoint = node