Search in sources :

Example 1 with BlockCreator

use of org.hyperledger.besu.ethereum.blockcreation.BlockCreator in project besu by hyperledger.

the class PkiQbftBlockCreatorTest method before.

@Before
public void before() {
    blockCreator = mock(BlockCreator.class);
    cmsCreator = mock(CmsCreator.class);
    pkiQbftBlockCreator = new PkiQbftBlockCreator(blockCreator, cmsCreator, extraDataCodec);
    blockHeaderBuilder = new BlockHeaderTestFixture();
}
Also used : BlockHeaderTestFixture(org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture) BlockCreator(org.hyperledger.besu.ethereum.blockcreation.BlockCreator) CmsCreator(org.hyperledger.besu.pki.cms.CmsCreator) Before(org.junit.Before)

Example 2 with BlockCreator

use of org.hyperledger.besu.ethereum.blockcreation.BlockCreator 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);
}
Also used : ConsensusRoundIdentifier(org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier) QbftMessageTransmitter(org.hyperledger.besu.consensus.qbft.network.QbftMessageTransmitter) BlockCreator(org.hyperledger.besu.ethereum.blockcreation.BlockCreator)

Example 3 with BlockCreator

use of org.hyperledger.besu.ethereum.blockcreation.BlockCreator in project besu by hyperledger.

the class IbftRoundFactory method createNewRoundWithState.

public IbftRound createNewRoundWithState(final BlockHeader parentHeader, final RoundState roundState) {
    final ConsensusRoundIdentifier roundIdentifier = roundState.getRoundIdentifier();
    final BlockCreator blockCreator = blockCreatorFactory.create(parentHeader, roundIdentifier.getRoundNumber());
    final IbftMessageTransmitter messageTransmitter = new IbftMessageTransmitter(messageFactory, finalState.getValidatorMulticaster());
    return new IbftRound(roundState, blockCreator, protocolContext, protocolSchedule.getByBlockNumber(roundIdentifier.getSequenceNumber()).getBlockImporter(), minedBlockObservers, finalState.getNodeKey(), messageFactory, messageTransmitter, finalState.getRoundTimer(), bftExtraDataCodec);
}
Also used : ConsensusRoundIdentifier(org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier) BlockCreator(org.hyperledger.besu.ethereum.blockcreation.BlockCreator) IbftMessageTransmitter(org.hyperledger.besu.consensus.ibft.network.IbftMessageTransmitter)

Example 4 with BlockCreator

use of org.hyperledger.besu.ethereum.blockcreation.BlockCreator in project besu by hyperledger.

the class QbftBlockCreatorFactory method create.

@Override
public BlockCreator create(final BlockHeader parentHeader, final int round) {
    final BlockCreator blockCreator = super.create(parentHeader, round);
    final QbftContext qbftContext = protocolContext.getConsensusContext(QbftContext.class);
    if (qbftContext.getPkiBlockCreationConfiguration().isEmpty()) {
        return blockCreator;
    } else {
        return new PkiQbftBlockCreator(blockCreator, qbftContext.getPkiBlockCreationConfiguration().get(), bftExtraDataCodec);
    }
}
Also used : BlockCreator(org.hyperledger.besu.ethereum.blockcreation.BlockCreator) QbftContext(org.hyperledger.besu.consensus.qbft.QbftContext)

Aggregations

BlockCreator (org.hyperledger.besu.ethereum.blockcreation.BlockCreator)4 ConsensusRoundIdentifier (org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier)2 IbftMessageTransmitter (org.hyperledger.besu.consensus.ibft.network.IbftMessageTransmitter)1 QbftContext (org.hyperledger.besu.consensus.qbft.QbftContext)1 QbftMessageTransmitter (org.hyperledger.besu.consensus.qbft.network.QbftMessageTransmitter)1 BlockHeaderTestFixture (org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture)1 CmsCreator (org.hyperledger.besu.pki.cms.CmsCreator)1 Before (org.junit.Before)1