From 0fa43b8b8ca3627e95ae9c54b2d304386b05e9aa Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Tue, 10 May 2022 13:24:54 +0300 Subject: [PATCH] small refactor --- .../executionlayer/ExecutionLayerManagerImpl.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java b/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java index f778cc0eea5..df21e6a9d1f 100644 --- a/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java +++ b/ethereum/executionlayer/src/main/java/tech/pegasys/teku/ethereum/executionlayer/ExecutionLayerManagerImpl.java @@ -327,17 +327,18 @@ private void updateBuilderAvailability() { .finish( statusResponse -> { if (statusResponse.getErrorMessage() != null) { - latestBuilderAvailability.set(false); - eventLogger.executionBuilderIsOffline(statusResponse.getErrorMessage()); + markBuilderAsNotAvailable(statusResponse.getErrorMessage()); } else { if (latestBuilderAvailability.compareAndSet(false, true)) { eventLogger.executionBuilderIsBackOnline(); } } }, - throwable -> { - latestBuilderAvailability.set(false); - eventLogger.executionBuilderIsOffline(throwable.getMessage()); - }); + throwable -> markBuilderAsNotAvailable(throwable.getMessage())); + } + + private void markBuilderAsNotAvailable(String errorMessage) { + latestBuilderAvailability.set(false); + eventLogger.executionBuilderIsOffline(errorMessage); } }