@Test public void shouldDelayExecutingDutiesUntilSchedulingIsComplete() { final ScheduledDuties scheduledDuties = mock(ScheduledDuties.class); final StubMetricsSystem metricsSystem = new StubMetricsSystem(); final ValidatorTimingChannel dutyScheduler = new BlockDutyScheduler( metricsSystem, new RetryingDutyLoader( asyncRunner, new ValidatorApiDutyLoader( metricsSystem, validatorApiChannel, forkProvider, () -> scheduledDuties, Map.of(VALIDATOR1_KEY, validator1, VALIDATOR2_KEY, validator2)))); final SafeFuture<Optional<List<ValidatorDuties>>> epoch0Duties = new SafeFuture<>(); when(validatorApiChannel.getDuties(eq(ZERO), any())).thenReturn(epoch0Duties); when(validatorApiChannel.getDuties(eq(ONE), any())) .thenReturn(SafeFuture.completedFuture(Optional.of(emptyList()))); dutyScheduler.onSlot(ZERO); dutyScheduler.onBlockProductionDue(ZERO); verify(scheduledDuties, never()).produceBlock(ZERO); epoch0Duties.complete(Optional.of(emptyList())); verify(scheduledDuties).produceBlock(ZERO); }
@Override public void onBlockProductionDue(final UInt64 slot) { notifyDutyQueue(DutyQueue::onBlockProductionDue, slot); }
BlockDutyScheduler extends AbstractDutyScheduler { @Override public void onBlockProductionDue(final UInt64 slot) { notifyDutyQueue(DutyQueue::onBlockProductionDue, slot); } }
BlockDutyScheduler extends AbstractDutyScheduler { @Override public void onBlockProductionDue(final UInt64 slot) { notifyDutyQueue(DutyQueue::onBlockProductionDue, slot); } BlockDutyScheduler(
      final MetricsSystem metricsSystem, final DutyLoader epochDutiesScheduler); }
BlockDutyScheduler extends AbstractDutyScheduler { @Override public void onBlockProductionDue(final UInt64 slot) { notifyDutyQueue(DutyQueue::onBlockProductionDue, slot); } BlockDutyScheduler(
      final MetricsSystem metricsSystem, final DutyLoader epochDutiesScheduler); @Override void onBlockProductionDue(final UInt64 slot); }
BlockDutyScheduler extends AbstractDutyScheduler { @Override public void onBlockProductionDue(final UInt64 slot) { notifyDutyQueue(DutyQueue::onBlockProductionDue, slot); } BlockDutyScheduler(
      final MetricsSystem metricsSystem, final DutyLoader epochDutiesScheduler); @Override void onBlockProductionDue(final UInt64 slot);  }