use of org.hyperledger.besu.consensus.ibft.IbftLegacyContext in project besu by hyperledger.
the class IbftLegacyBesuControllerBuilder method createConsensusContext.
@Override
protected IbftLegacyContext createConsensusContext(final Blockchain blockchain, final WorldStateArchive worldStateArchive, final ProtocolSchedule protocolSchedule) {
final IbftLegacyConfigOptions ibftConfig = configOptionsSupplier.get().getIbftLegacyConfigOptions();
final EpochManager epochManager = new EpochManager(ibftConfig.getEpochLength());
final ValidatorProvider validatorProvider = BlockValidatorProvider.nonForkingValidatorProvider(blockchain, epochManager, blockInterface);
return new IbftLegacyContext(validatorProvider, epochManager, blockInterface);
}
use of org.hyperledger.besu.consensus.ibft.IbftLegacyContext in project besu by hyperledger.
the class IbftBlockHeaderValidationRulesetFactoryTest method setupContextWithValidators.
private ProtocolContext setupContextWithValidators(final Collection<Address> validators) {
final IbftLegacyContext bftContext = mock(IbftLegacyContext.class);
final ValidatorProvider mockValidatorProvider = mock(ValidatorProvider.class);
when(bftContext.getValidatorProvider()).thenReturn(mockValidatorProvider);
when(mockValidatorProvider.getValidatorsAfterBlock(any())).thenReturn(validators);
when(bftContext.as(Mockito.any())).thenReturn(bftContext);
return new ProtocolContext(null, null, bftContext);
}
use of org.hyperledger.besu.consensus.ibft.IbftLegacyContext in project besu by hyperledger.
the class IbftLegacyContextBuilder method setupContextWithValidators.
public static IbftLegacyContext setupContextWithValidators(final Collection<Address> validators) {
final IbftLegacyContext bftContext = mock(IbftLegacyContext.class, withSettings().lenient());
final ValidatorProvider mockValidatorProvider = mock(ValidatorProvider.class, withSettings().lenient());
when(bftContext.getValidatorProvider()).thenReturn(mockValidatorProvider);
when(mockValidatorProvider.getValidatorsAfterBlock(any())).thenReturn(validators);
when(bftContext.as(Mockito.any())).thenReturn(bftContext);
return bftContext;
}
Aggregations