diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/AbstractProposerConfigProvider.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/AbstractProposerConfigProvider.java index 0a92374b516..eba32d4dec8 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/AbstractProposerConfigProvider.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/AbstractProposerConfigProvider.java @@ -47,10 +47,8 @@ public synchronized SafeFuture> getProposerConfig() { } if (futureProposerConfig.isPresent()) { - if (lastProposerConfig.isPresent()) { - LOG.warn("A proposer config load is in progress, providing last loaded config"); - return SafeFuture.completedFuture(lastProposerConfig); - } + LOG.warn( + "A proposer config load is already progress, waiting it instead of generating a new request"); return futureProposerConfig.get(); } futureProposerConfig = diff --git a/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/ProposerConfigProviderTest.java b/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/ProposerConfigProviderTest.java index 41b612c032f..76aa9938148 100644 --- a/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/ProposerConfigProviderTest.java +++ b/validator/client/src/test/java/tech/pegasys/teku/validator/client/proposerconfig/ProposerConfigProviderTest.java @@ -97,7 +97,7 @@ void getProposerConfig_onErrorShouldReturnLastConfigWhenLastConfigAvailable() { } @Test - void getProposerConfig_onConcurrentCallsShouldMergeFuturesWhenNoLastConfigAvailable() { + void getProposerConfig_onConcurrentCallsShouldMergeFutures() { SafeFuture> futureMaybeConfig = proposerConfigProvider.getProposerConfig(); @@ -112,28 +112,6 @@ void getProposerConfig_onConcurrentCallsShouldMergeFuturesWhenNoLastConfigAvaila assertThat(futureMaybeConfig).isCompletedWithValue(Optional.of(proposerConfigA)); } - @Test - void getProposerConfig_onConcurrentCallsShouldReturnLastConfigWhenLastConfigAvailable() { - SafeFuture> futureMaybeConfig = - proposerConfigProvider.getProposerConfig(); - - when(proposerConfigLoader.getProposerConfig(sourceUrl)).thenReturn(proposerConfigA); - asyncRunner.executeQueuedActions(); - - assertThat(futureMaybeConfig).isCompletedWithValue(Optional.of(proposerConfigA)); - - futureMaybeConfig = proposerConfigProvider.getProposerConfig(); - SafeFuture> futureMaybeConfig2 = - proposerConfigProvider.getProposerConfig(); - - assertThat(futureMaybeConfig2).isCompletedWithValue(Optional.of(proposerConfigA)); - - when(proposerConfigLoader.getProposerConfig(sourceUrl)).thenReturn(proposerConfigB); - asyncRunner.executeQueuedActions(); - - assertThat(futureMaybeConfig).isCompletedWithValue(Optional.of(proposerConfigB)); - } - @Test void getProposerConfig_shouldAlwaysReturnFirstValidConfigWhenRefreshIsFalse() { final ProposerConfigProvider proposerConfigProvider =