use of org.hyperledger.besu.consensus.qbft.network.QbftMessageTransmitter in project besu by hyperledger.
the class QbftRoundFactory method createNewRoundWithState.
public QbftRound createNewRoundWithState(final BlockHeader parentHeader, final RoundState roundState) {
final ConsensusRoundIdentifier roundIdentifier = roundState.getRoundIdentifier();
final BlockCreator blockCreator = blockCreatorFactory.create(parentHeader, 0);
// TODO(tmm): Why is this created everytime?!
final QbftMessageTransmitter messageTransmitter = new QbftMessageTransmitter(messageFactory, finalState.getValidatorMulticaster());
return new QbftRound(roundState, blockCreator, protocolContext, protocolSchedule.getByBlockNumber(roundIdentifier.getSequenceNumber()).getBlockImporter(), minedBlockObservers, finalState.getNodeKey(), messageFactory, messageTransmitter, finalState.getRoundTimer(), bftExtraDataCodec);
}
use of org.hyperledger.besu.consensus.qbft.network.QbftMessageTransmitter in project besu by hyperledger.
the class QbftRoundIntegrationTest method setup.
@BeforeEach
public void setup() {
when(messageValidator.validateProposal(any())).thenReturn(true);
when(messageValidator.validatePrepare(any())).thenReturn(true);
when(messageValidator.validateCommit(any())).thenReturn(true);
when(nodeKey.sign(any())).thenThrow(new SecurityModuleException("Hsm Is Down"));
final QbftExtraDataCodec qbftExtraDataEncoder = new QbftExtraDataCodec();
throwingMessageFactory = new MessageFactory(nodeKey);
transmitter = new QbftMessageTransmitter(throwingMessageFactory, multicaster);
final BftExtraData proposedExtraData = new BftExtraData(Bytes.wrap(new byte[32]), emptyList(), empty(), 0, emptyList());
final BlockHeaderTestFixture headerTestFixture = new BlockHeaderTestFixture();
headerTestFixture.extraData(qbftExtraDataEncoder.encode(proposedExtraData));
headerTestFixture.number(1);
final BlockHeader header = headerTestFixture.buildHeader();
proposedBlock = new Block(header, new BlockBody(emptyList(), emptyList()));
when(blockImporter.importBlock(any(), any(), any())).thenReturn(true);
protocolContext = new ProtocolContext(blockChain, worldStateArchive, setupContextWithBftExtraDataEncoder(QbftContext.class, emptyList(), qbftExtraDataEncoder));
}
Aggregations