use of com.radixdlt.consensus.Vote in project radixdlt by radixdlt.
the class BFTEventVerifierTest method when_process_bad_author_vote_then_should_not_be_forwarded.
@Test
public void when_process_bad_author_vote_then_should_not_be_forwarded() {
Vote vote = mock(Vote.class);
BFTNode author = mock(BFTNode.class);
when(vote.getAuthor()).thenReturn(author);
when(vote.getSignature()).thenReturn(mock(ECDSASignature.class));
when(validatorSet.containsNode(eq(author))).thenReturn(false);
when(verifier.verify(any(), any(), any())).thenReturn(true);
eventVerifier.processVote(vote);
verify(forwardTo, never()).processVote(any());
}
use of com.radixdlt.consensus.Vote in project radixdlt by radixdlt.
the class SafetyStateTest method when_build_with_new_last_vote__then_should_build_with_new_last_vote.
@Test
public void when_build_with_new_last_vote__then_should_build_with_new_last_vote() {
SafetyState safetyState = SafetyState.initialState();
Builder builder = safetyState.toBuilder();
Vote vote = mock(Vote.class);
builder.lastVote(vote);
SafetyState nextSafetyState = builder.build();
assertThat(nextSafetyState.getLastVote()).isEqualTo(Optional.of(vote));
assertThat(nextSafetyState.getLockedView()).isEqualTo(safetyState.getLockedView());
}
Aggregations