use of com.radixdlt.hotstuff.bft.ViewUpdate in project radixdlt by radixdlt.
the class PacemakerTest method setUp.
@Before
public void setUp() {
HighQC highQC = mock(HighQC.class);
QuorumCertificate committedQc = mock(QuorumCertificate.class);
when(committedQc.getView()).thenReturn(View.of(0));
when(highQC.highestCommittedQC()).thenReturn(committedQc);
ViewUpdate initialViewUpdate = ViewUpdate.create(View.of(0), highQC, mock(BFTNode.class), mock(BFTNode.class));
this.pacemaker = new Pacemaker(this.self, this.counters, this.validatorSet, this.vertexStore, this.safetyRules, this.timeoutDispatcher, this.timeoutSender, this.timeoutCalculator, this.nextTxnsGenerator, this.proposalDispatcher, this.voteDispatcher, hasher, timeSupplier, initialViewUpdate, new SystemCountersImpl());
}
use of com.radixdlt.hotstuff.bft.ViewUpdate in project radixdlt by radixdlt.
the class PacemakerTest method when_local_timeout__then_resend_previous_vote.
@Test
public void when_local_timeout__then_resend_previous_vote() {
View view = View.of(0);
Vote lastVote = mock(Vote.class);
Vote lastVoteWithTimeout = mock(Vote.class);
ImmutableSet<BFTNode> validators = rmock(ImmutableSet.class);
when(this.safetyRules.getLastVote(view)).thenReturn(Optional.of(lastVote));
when(this.safetyRules.timeoutVote(lastVote)).thenReturn(lastVoteWithTimeout);
when(this.validatorSet.nodes()).thenReturn(validators);
ViewUpdate viewUpdate = ViewUpdate.create(View.of(0), mock(HighQC.class), mock(BFTNode.class), mock(BFTNode.class));
this.pacemaker.processLocalTimeout(ScheduledLocalTimeout.create(viewUpdate, 0L));
verify(this.voteDispatcher, times(1)).dispatch(eq(validators), eq(lastVoteWithTimeout));
verifyNoMoreInteractions(this.vertexStore);
verify(this.safetyRules, times(1)).getLastVote(view);
verify(this.safetyRules, times(1)).timeoutVote(lastVote);
verifyNoMoreInteractions(this.safetyRules);
}
Aggregations