diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java index 0611c0483c2..a4178b173c0 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java @@ -68,7 +68,7 @@ public class ValidatorClientService extends Service { private final List validatorTimingChannels = new ArrayList<>(); private ValidatorStatusLogger validatorStatusLogger; private ValidatorIndexProvider validatorIndexProvider; - private ProposerConfigProvider proposerConfigProvider; + private Optional proposerConfigProvider; private final SafeFuture initializationComplete = new SafeFuture<>(); @@ -186,13 +186,6 @@ private void initializeValidators( validatorLoader.loadValidators(); final OwnedValidators validators = validatorLoader.getOwnedValidators(); - this.proposerConfigProvider = - ProposerConfigProvider.create( - asyncRunner, - config.getValidatorConfig().getRefreshProposerConfigFromSource(), - new ProposerConfigLoader(new JsonProvider().getObjectMapper()), - config.getValidatorConfig().getProposerConfigSource()); - this.validatorIndexProvider = new ValidatorIndexProvider(validators, validatorApiChannel, asyncRunner); final BlockDutyFactory blockDutyFactory = @@ -247,13 +240,23 @@ private void initializeValidators( } if (spec.isMilestoneSupported(SpecMilestone.BELLATRIX)) { + proposerConfigProvider = + Optional.of( + ProposerConfigProvider.create( + asyncRunner, + config.getValidatorConfig().getRefreshProposerConfigFromSource(), + new ProposerConfigLoader(new JsonProvider().getObjectMapper()), + config.getValidatorConfig().getProposerConfigSource())); + validatorTimingChannels.add( new BeaconProposerPreparer( validatorApiChannel, validatorIndexProvider, - proposerConfigProvider, + proposerConfigProvider.get(), config.getValidatorConfig().getProposerDefaultFeeRecipient(), spec)); + } else { + proposerConfigProvider = Optional.empty(); } addValidatorCountMetric(metricsSystem, validators); this.validatorStatusLogger = @@ -293,7 +296,11 @@ private static void addValidatorCountMetric( @Override protected SafeFuture doStart() { return initializationComplete - .thenCompose(__ -> proposerConfigProvider.getProposerConfig()) + .thenCompose( + __ -> + proposerConfigProvider + .map(ProposerConfigProvider::getProposerConfig) + .orElse(SafeFuture.completedFuture(Optional.empty()))) .thenCompose( __ -> { validatorRestApi.ifPresent(restApi -> restApi.start().reportExceptions());