Skip to content

Commit

Permalink
fix: move and fix execution engine state update checks for online state
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Aug 8, 2023
1 parent df2f4d3 commit 15c041b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 8 additions & 0 deletions packages/beacon-node/src/execution/engine/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,14 @@ export class ExecutionEngineHttp implements IExecutionEngine {

if (oldState === newState) return;

// The ONLINE is initial state and can reached from offline or auth failed error
if (
newState === ExecutionEngineState.ONLINE &&
!(oldState === ExecutionEngineState.OFFLINE || oldState === ExecutionEngineState.AUTH_FAILED)
) {
return;
}

switch (newState) {
case ExecutionEngineState.ONLINE:
this.logger.info("Execution client became online", {oldState, newState});
Expand Down
10 changes: 0 additions & 10 deletions packages/beacon-node/src/execution/engine/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,5 @@ export function getExecutionEngineState<S extends ExecutionPayloadStatus | undef
? getExecutionEngineStateForPayloadError(payloadError, oldState)
: getExecutionEngineStateForPayloadStatus(payloadStatus);

if (newState === oldState) return oldState;

// The ONLINE is initial state and can reached from offline or auth failed error
if (
newState === ExecutionEngineState.ONLINE &&
!(oldState === ExecutionEngineState.OFFLINE || oldState === ExecutionEngineState.AUTH_FAILED)
) {
return oldState;
}

return newState;
}

0 comments on commit 15c041b

Please sign in to comment.