use of org.hyperledger.besu.consensus.ibft.validation.SignedDataValidator in project besu by hyperledger.
the class RoundChangeManagerTest method setup.
@Before
public void setup() {
validators.add(Util.publicKeyToAddress(proposerKey.getPublicKey()));
validators.add(Util.publicKeyToAddress(validator1Key.getPublicKey()));
validators.add(Util.publicKeyToAddress(validator2Key.getPublicKey()));
final BlockValidator blockValidator = mock(BlockValidator.class);
when(blockValidator.validateAndProcessBlock(any(), any(), any(), any())).thenReturn(new Result(new BlockProcessingOutputs(null, null)));
final RoundChangePayloadValidator.MessageValidatorForHeightFactory messageValidatorFactory = mock(RoundChangePayloadValidator.MessageValidatorForHeightFactory.class);
when(messageValidatorFactory.createAt(ri1)).thenAnswer(invocation -> new SignedDataValidator(validators, Util.publicKeyToAddress(proposerKey.getPublicKey()), ri1));
when(messageValidatorFactory.createAt(ri2)).thenAnswer(invocation -> new SignedDataValidator(validators, Util.publicKeyToAddress(validator1Key.getPublicKey()), ri2));
when(messageValidatorFactory.createAt(ri3)).thenAnswer(invocation -> new SignedDataValidator(validators, Util.publicKeyToAddress(validator2Key.getPublicKey()), ri3));
final RoundChangeMessageValidator roundChangeMessageValidator = new RoundChangeMessageValidator(new RoundChangePayloadValidator(messageValidatorFactory, validators, BftHelpers.calculateRequiredValidatorQuorum(BftHelpers.calculateRequiredValidatorQuorum(validators.size())), 2), proposalConsistencyValidator, bftBlockInterface);
manager = new RoundChangeManager(2, roundChangeMessageValidator);
when(proposalConsistencyValidator.validateProposalMatchesBlock(any(), any(), any())).thenReturn(true);
}
Aggregations