diff --git a/beacon_chain/rpc/rest_node_api.nim b/beacon_chain/rpc/rest_node_api.nim index d55237af1..04e2d5480 100644 --- a/beacon_chain/rpc/rest_node_api.nim +++ b/beacon_chain/rpc/rest_node_api.nim @@ -253,7 +253,19 @@ proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) = # https://ethereum.github.io/beacon-APIs/#/Node/getSyncingStatus router.api(MethodGet, "/eth/v1/node/syncing") do () -> RestApiResponse: - return RestApiResponse.jsonResponse(node.syncManager.getInfo()) + let + wallSlot = node.beaconClock.now().slotOrZero() + headSlot = node.dag.head.slot + distance = wallSlot - headSlot + info = RestSyncInfo( + head_slot: headSlot, sync_distance: distance, + is_syncing: + if isNil(node.syncManager): + false + else: + node.syncManager.inProgress + ) + return RestApiResponse.jsonResponse(info) # https://ethereum.github.io/beacon-APIs/#/Node/getHealth router.api(MethodGet, "/eth/v1/node/health") do () -> RestApiResponse: diff --git a/beacon_chain/sync/sync_manager.nim b/beacon_chain/sync/sync_manager.nim index 451ea0bbb..2131d59b1 100644 --- a/beacon_chain/sync/sync_manager.nim +++ b/beacon_chain/sync/sync_manager.nim @@ -669,14 +669,3 @@ proc syncLoop[A, B](man: SyncManager[A, B]) {.async.} = proc start*[A, B](man: SyncManager[A, B]) = ## Starts SyncManager's main loop. man.syncFut = man.syncLoop() - -proc getInfo*[A, B](man: SyncManager[A, B]): RestSyncInfo = - ## Returns current synchronization information for RPC call. - let wallSlot = man.getLocalWallSlot() - let headSlot = man.getLocalHeadSlot() - let sync_distance = wallSlot - headSlot - RestSyncInfo( - head_slot: headSlot, - sync_distance: sync_distance, - is_syncing: man.inProgress - )