Skip to content

Commit

Permalink
fix AT
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Jan 31, 2022
1 parent 584b759 commit 6e533e9
Showing 1 changed file with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class ValidatorClientService extends Service {
private final List<ValidatorTimingChannel> validatorTimingChannels = new ArrayList<>();
private ValidatorStatusLogger validatorStatusLogger;
private ValidatorIndexProvider validatorIndexProvider;
private ProposerConfigProvider proposerConfigProvider;
private Optional<ProposerConfigProvider> proposerConfigProvider;

private final SafeFuture<Void> initializationComplete = new SafeFuture<>();

Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 6e533e9

Please sign in to comment.