diff --git a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java index 45fddb13573..53f43bdc332 100644 --- a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java +++ b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java @@ -54,6 +54,7 @@ import tech.pegasys.teku.storage.server.pruner.StatePruner; public class StorageService extends Service implements StorageServiceFacade { + public static final Duration STATE_PRUNING_INTERVAL = Duration.ofMinutes(1); private final StorageConfiguration config; private volatile ChainStorage chainStorage; private final ServiceConfig serviceConfig; @@ -143,7 +144,7 @@ protected SafeFuture doStart() { config .getStatePruningInterval() .equals(StorageConfiguration.DEFAULT_STATE_PRUNING_INTERVAL) - ? Duration.ofMinutes(1) + ? STATE_PRUNING_INTERVAL : config.getStatePruningInterval(); configureStatePruner( StorageConfiguration.DEFAULT_STORAGE_RETAINED_SLOTS, diff --git a/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java b/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java index cfe8c20797d..eddd7ca6f65 100644 --- a/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java +++ b/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java @@ -113,7 +113,7 @@ void shouldSetupStatePrunerWhenPruneMode() { assertThat(maybeStatePruner).isPresent(); final StatePruner statePruner = maybeStatePruner.get(); assertThat(statePruner.isRunning()).isTrue(); - assertThat(statePruner.getPruneInterval()).isEqualTo(Duration.ofMinutes(1)); + assertThat(statePruner.getPruneInterval()).isEqualTo(StorageService.STATE_PRUNING_INTERVAL); } @Test @@ -125,7 +125,7 @@ void shouldSetupStatePrunerWhenMinimalMode() { assertThat(maybeStatePruner).isPresent(); final StatePruner statePruner = maybeStatePruner.get(); assertThat(statePruner.isRunning()).isTrue(); - assertThat(statePruner.getPruneInterval()).isEqualTo(Duration.ofMinutes(1)); + assertThat(statePruner.getPruneInterval()).isEqualTo(StorageService.STATE_PRUNING_INTERVAL); } @Test