use of tech.pegasys.teku.spec.datastructures.util.AttestationProcessingResult.SUCCESSFUL in project teku by ConsenSys.
the class ValidatorApiHandlerTest method sendAggregateAndProofs_shouldProcessMixOfValidAndInvalidAggregates.
@Test
void sendAggregateAndProofs_shouldProcessMixOfValidAndInvalidAggregates() {
final SignedAggregateAndProof invalidAggregate = dataStructureUtil.randomSignedAggregateAndProof();
final SignedAggregateAndProof validAggregate = dataStructureUtil.randomSignedAggregateAndProof();
when(attestationManager.onAttestation(ValidateableAttestation.aggregateFromValidator(spec, invalidAggregate))).thenReturn(completedFuture(AttestationProcessingResult.invalid("Bad juju")));
when(attestationManager.onAttestation(ValidateableAttestation.aggregateFromValidator(spec, validAggregate))).thenReturn(completedFuture(SUCCESSFUL));
final SafeFuture<List<SubmitDataError>> result = validatorApiHandler.sendAggregateAndProofs(List.of(invalidAggregate, validAggregate));
assertThat(result).isCompletedWithValue(List.of(new SubmitDataError(ZERO, "Bad juju")));
// Should send both to the attestation manager.
verify(attestationManager).onAttestation(argThat(validatableAttestation -> validatableAttestation.getSignedAggregateAndProof().equals(validAggregate)));
verify(attestationManager).onAttestation(argThat(validatableAttestation -> validatableAttestation.getSignedAggregateAndProof().equals(invalidAggregate)));
}
Aggregations