use of org.hyperledger.besu.consensus.common.bft.events.BftReceivedMessageEvent in project besu by hyperledger.
the class QbftControllerTest method proposalForCurrentHeightIsPassedToBlockHeightManager.
@Test
public void proposalForCurrentHeightIsPassedToBlockHeightManager() {
setupProposal(roundIdentifier, validator);
constructQbftController();
qbftController.start();
qbftController.handleMessageEvent(new BftReceivedMessageEvent(proposalMessage));
verify(futureMessageBuffer, never()).addMessage(anyLong(), any());
verify(blockHeightManager).handleProposalPayload(proposal);
verify(qbftGossip).send(proposalMessage);
verify(blockHeightManager, atLeastOnce()).getChainHeight();
verifyNoMoreInteractions(blockHeightManager);
}
use of org.hyperledger.besu.consensus.common.bft.events.BftReceivedMessageEvent in project besu by hyperledger.
the class QbftControllerTest method roundChangeForUnknownValidatorIsDiscarded.
@Test
public void roundChangeForUnknownValidatorIsDiscarded() {
setupRoundChange(roundIdentifier, unknownValidator);
verifyNotHandledAndNoFutureMsgs(new BftReceivedMessageEvent(roundChangeMessage));
}
use of org.hyperledger.besu.consensus.common.bft.events.BftReceivedMessageEvent in project besu by hyperledger.
the class QbftControllerTest method roundChangeForPastHeightIsDiscarded.
@Test
public void roundChangeForPastHeightIsDiscarded() {
setupRoundChange(pastRoundIdentifier, validator);
verifyNotHandledAndNoFutureMsgs(new BftReceivedMessageEvent(roundChangeMessage));
}
use of org.hyperledger.besu.consensus.common.bft.events.BftReceivedMessageEvent in project besu by hyperledger.
the class QbftControllerTest method messagesWhichAreAboveHeightManagerButBelowBlockChainLengthAreDiscarded.
@Test
public void messagesWhichAreAboveHeightManagerButBelowBlockChainLengthAreDiscarded() {
// NOTE: for this to occur, the system would need to be synchronising - i.e. blockchain is
// moving up faster than qbft loop is handling NewBlock messages
final long blockchainLength = 10L;
final long blockHeightManagerTargettingBlock = 6L;
final long messageHeight = 8L;
setupProposal(new ConsensusRoundIdentifier(messageHeight, 0), validator);
when(blockChain.getChainHeadHeader()).thenReturn(chainHeadBlockHeader);
when(blockChain.getChainHeadBlockNumber()).thenReturn(blockchainLength);
when(blockHeightManagerFactory.create(any())).thenReturn(blockHeightManager);
when(blockHeightManager.getChainHeight()).thenReturn(blockHeightManagerTargettingBlock);
constructQbftController();
qbftController.start();
qbftController.handleMessageEvent(new BftReceivedMessageEvent(proposalMessage));
verify(futureMessageBuffer, never()).addMessage(anyLong(), any());
verify(blockHeightManager, never()).handleProposalPayload(any());
}
use of org.hyperledger.besu.consensus.common.bft.events.BftReceivedMessageEvent in project besu by hyperledger.
the class QbftControllerTest method roundChangeForCurrentHeightIsPassedToBlockHeightManager.
@Test
public void roundChangeForCurrentHeightIsPassedToBlockHeightManager() {
setupRoundChange(roundIdentifier, validator);
constructQbftController();
qbftController.start();
qbftController.handleMessageEvent(new BftReceivedMessageEvent(roundChangeMessage));
verify(futureMessageBuffer, never()).addMessage(anyLong(), any());
verify(blockHeightManager).handleRoundChangePayload(roundChange);
verify(qbftGossip).send(roundChangeMessage);
verify(blockHeightManager, atLeastOnce()).getChainHeight();
verifyNoMoreInteractions(blockHeightManager);
}
Aggregations