From cd9b50bbbce15cf07f4a2a43d8eb4b2d1ae90a1b Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Wed, 17 Aug 2022 01:14:32 +0300 Subject: [PATCH] Address #3962 (#3968) --- .../validator_client/fallback_service.nim | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/beacon_chain/validator_client/fallback_service.nim b/beacon_chain/validator_client/fallback_service.nim index 8a7832eac..b8b56aa87 100644 --- a/beacon_chain/validator_client/fallback_service.nim +++ b/beacon_chain/validator_client/fallback_service.nim @@ -184,14 +184,27 @@ proc checkSync(vc: ValidatorClientRef, return node.syncInfo = some(syncInfo) node.status = - if not(syncInfo.is_syncing) or (syncInfo.sync_distance < SYNC_TOLERANCE): - info "Beacon node is in sync", sync_distance = syncInfo.sync_distance, - head_slot = syncInfo.head_slot - RestBeaconNodeStatus.Online - else: - warn "Beacon node not in sync", sync_distance = syncInfo.sync_distance, - head_slot = syncInfo.head_slot - RestBeaconNodeStatus.NotSynced + block: + let optimistic = + if syncInfo.is_optimistic.isNone(): + "none" + else: + $syncInfo.is_optimistic.get() + + 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.} = logScope: endpoint = node