Search in sources :

Example 6 with ViewUpdate

use of com.radixdlt.consensus.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);
}
Also used : ViewUpdate(com.radixdlt.consensus.bft.ViewUpdate) HighQC(com.radixdlt.consensus.HighQC) BFTNode(com.radixdlt.consensus.bft.BFTNode) Vote(com.radixdlt.consensus.Vote) View(com.radixdlt.consensus.bft.View) Test(org.junit.Test)

Example 7 with ViewUpdate

use of com.radixdlt.consensus.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());
}
Also used : HighQC(com.radixdlt.consensus.HighQC) ViewUpdate(com.radixdlt.consensus.bft.ViewUpdate) BFTNode(com.radixdlt.consensus.bft.BFTNode) QuorumCertificate(com.radixdlt.consensus.QuorumCertificate) SystemCountersImpl(com.radixdlt.counters.SystemCountersImpl) Before(org.junit.Before)

Aggregations

ViewUpdate (com.radixdlt.consensus.bft.ViewUpdate)7 HighQC (com.radixdlt.consensus.HighQC)6 BFTNode (com.radixdlt.consensus.bft.BFTNode)6 Vote (com.radixdlt.consensus.Vote)5 BFTInsertUpdate (com.radixdlt.consensus.bft.BFTInsertUpdate)4 View (com.radixdlt.consensus.bft.View)4 AbstractModule (com.google.inject.AbstractModule)3 TypeLiteral (com.google.inject.TypeLiteral)3 BFTConfiguration (com.radixdlt.consensus.BFTConfiguration)3 Proposal (com.radixdlt.consensus.Proposal)3 BFTCommittedUpdate (com.radixdlt.consensus.bft.BFTCommittedUpdate)3 BFTHighQCUpdate (com.radixdlt.consensus.bft.BFTHighQCUpdate)3 BFTRebuildUpdate (com.radixdlt.consensus.bft.BFTRebuildUpdate)3 Self (com.radixdlt.consensus.bft.Self)3 LocalTimeoutOccurrence (com.radixdlt.consensus.liveness.LocalTimeoutOccurrence)3 NextTxnsGenerator (com.radixdlt.consensus.liveness.NextTxnsGenerator)3 ScheduledLocalTimeout (com.radixdlt.consensus.liveness.ScheduledLocalTimeout)3 BFTSyncPatienceMillis (com.radixdlt.consensus.sync.BFTSyncPatienceMillis)3 GetVerticesErrorResponse (com.radixdlt.consensus.sync.GetVerticesErrorResponse)3 GetVerticesRequest (com.radixdlt.consensus.sync.GetVerticesRequest)3