Skip to content

Commit

Permalink
allow NeverTested > Working transition for EL connection
Browse files Browse the repository at this point in the history
Since #4960, the EL connection status can no longer transition from
`NeverTested` to `Working`. Fix that, and also consider `NeverTested`
connections as online for the purpose of the `el_offline` REST response.
  • Loading branch information
etan-status committed May 25, 2023
1 parent 74b670a commit 0762fab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions beacon_chain/el/el_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,16 @@ proc setDegradedState(connection: ELConnection,

proc setWorkingState(connection: ELConnection) =
case connection.state
of NeverTested:
connection.hysteresisCounter = 0
connection.state = Working
of Degraded:
if connection.increaseCounterTowardsStateChange():
info "Connection to EL node restored",
url = url(connection.engineUrl)

connection.state = Working
of NeverTested, Working:
of Working:
connection.decreaseCounterTowardsStateChange()

proc trackEngineApiRequest(connection: ELConnection,
Expand Down Expand Up @@ -1973,7 +1976,7 @@ func hasConnection*(m: ELManager): bool =
m.elConnections.len > 0

func hasAnyWorkingConnection*(m: ELManager): bool =
m.elConnections.anyIt(it.state == Working)
m.elConnections.anyIt(it.state == Working or it.state == NeverTested)

func hasProperlyConfiguredConnection*(m: ELManager): bool =
for connection in m.elConnections:
Expand Down

0 comments on commit 0762fab

Please sign in to comment.