Search in sources :

Example 1 with SubsequentMessageValidator

use of org.hyperledger.besu.consensus.qbft.validation.MessageValidator.SubsequentMessageValidator in project besu by hyperledger.

the class MessageValidatorFactory method createMessageValidator.

public MessageValidator createMessageValidator(final ConsensusRoundIdentifier roundIdentifier, final BlockHeader parentHeader) {
    final Collection<Address> validatorsForHeight = getValidatorsAfterBlock(parentHeader);
    final BlockValidator blockValidator = protocolSchedule.getByBlockNumber(roundIdentifier.getSequenceNumber()).getBlockValidator();
    final ProposalValidator proposalValidator = new ProposalValidator(blockValidator, protocolContext, BftHelpers.calculateRequiredValidatorQuorum(validatorsForHeight.size()), validatorsForHeight, roundIdentifier, proposerSelector.selectProposerForRound(roundIdentifier), bftExtraDataCodec);
    final BftBlockInterface blockInterface = protocolContext.getConsensusContext(BftContext.class).getBlockInterface();
    return new MessageValidator(block -> new SubsequentMessageValidator(validatorsForHeight, roundIdentifier, block, blockInterface, bftExtraDataCodec), proposalValidator);
}
Also used : BftBlockInterface(org.hyperledger.besu.consensus.common.bft.BftBlockInterface) Address(org.hyperledger.besu.datatypes.Address) BftContext(org.hyperledger.besu.consensus.common.bft.BftContext) SubsequentMessageValidator(org.hyperledger.besu.consensus.qbft.validation.MessageValidator.SubsequentMessageValidator) BlockValidator(org.hyperledger.besu.ethereum.BlockValidator) SubsequentMessageValidator(org.hyperledger.besu.consensus.qbft.validation.MessageValidator.SubsequentMessageValidator)

Aggregations

BftBlockInterface (org.hyperledger.besu.consensus.common.bft.BftBlockInterface)1 BftContext (org.hyperledger.besu.consensus.common.bft.BftContext)1 SubsequentMessageValidator (org.hyperledger.besu.consensus.qbft.validation.MessageValidator.SubsequentMessageValidator)1 Address (org.hyperledger.besu.datatypes.Address)1 BlockValidator (org.hyperledger.besu.ethereum.BlockValidator)1