Skip to content

Commit

Permalink
fix: getHealth returns 206 status code if EL is optimistic or offline (
Browse files Browse the repository at this point in the history
…#6920)

* fix: getHealth returns 206 status code if EL is syncing / optimistic

* Report 206 if EL is offline
  • Loading branch information
nflaig committed Jul 5, 2024
1 parent 0c810b8 commit d56e871
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/beacon-node/src/api/impl/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export function getNodeApi(
throw new ApiError(400, `Invalid syncing status code: ${syncingStatus}`);
}

if (sync.getSyncStatus().isSyncing) {
const {isSyncing, isOptimistic, elOffline} = sync.getSyncStatus();

if (isSyncing || isOptimistic || elOffline) {
// 206: Node is syncing but can serve incomplete data
return {status: syncingStatus ?? routes.node.NodeHealth.SYNCING};
} else {
Expand Down

0 comments on commit d56e871

Please sign in to comment.