use of org.hyperledger.besu.consensus.common.bft.protocol.BftProtocolManager in project besu by hyperledger.
the class QbftBesuControllerBuilder method createSubProtocolConfiguration.
@Override
protected SubProtocolConfiguration createSubProtocolConfiguration(final EthProtocolManager ethProtocolManager, final Optional<SnapProtocolManager> maybeSnapProtocolManager) {
final SubProtocolConfiguration subProtocolConfiguration = new SubProtocolConfiguration().withSubProtocol(EthProtocol.get(), ethProtocolManager).withSubProtocol(Istanbul100SubProtocol.get(), new BftProtocolManager(bftEventQueue, peers, Istanbul100SubProtocol.ISTANBUL_100, Istanbul100SubProtocol.get().getName()));
maybeSnapProtocolManager.ifPresent(snapProtocolManager -> {
subProtocolConfiguration.withSubProtocol(SnapProtocol.get(), snapProtocolManager);
});
return subProtocolConfiguration;
}
use of org.hyperledger.besu.consensus.common.bft.protocol.BftProtocolManager in project besu by hyperledger.
the class IbftBesuControllerBuilder method createSubProtocolConfiguration.
@Override
protected SubProtocolConfiguration createSubProtocolConfiguration(final EthProtocolManager ethProtocolManager, final Optional<SnapProtocolManager> maybeSnapProtocolManager) {
final SubProtocolConfiguration subProtocolConfiguration = new SubProtocolConfiguration().withSubProtocol(EthProtocol.get(), ethProtocolManager).withSubProtocol(IbftSubProtocol.get(), new BftProtocolManager(bftEventQueue, peers, IbftSubProtocol.IBFV1, IbftSubProtocol.get().getName()));
maybeSnapProtocolManager.ifPresent(snapProtocolManager -> {
subProtocolConfiguration.withSubProtocol(SnapProtocol.get(), snapProtocolManager);
});
return subProtocolConfiguration;
}
use of org.hyperledger.besu.consensus.common.bft.protocol.BftProtocolManager in project besu by hyperledger.
the class RunnerBuilderTest method setup.
@Before
public void setup() {
final SubProtocolConfiguration subProtocolConfiguration = mock(SubProtocolConfiguration.class);
final EthProtocolManager ethProtocolManager = mock(EthProtocolManager.class);
final EthContext ethContext = mock(EthContext.class);
final ProtocolContext protocolContext = mock(ProtocolContext.class);
final NodeKey nodeKey = new NodeKey(new KeyPairSecurityModule(new SECP256K1().generateKeyPair()));
when(subProtocolConfiguration.getProtocolManagers()).thenReturn(Collections.singletonList(new BftProtocolManager(mock(BftEventQueue.class), mock(PeerConnectionTracker.class), IbftSubProtocol.IBFV1, IbftSubProtocol.get().getName())));
when(ethContext.getScheduler()).thenReturn(mock(EthScheduler.class));
when(ethProtocolManager.ethContext()).thenReturn(ethContext);
when(subProtocolConfiguration.getSubProtocols()).thenReturn(Collections.singletonList(new IbftSubProtocol()));
when(protocolContext.getBlockchain()).thenReturn(mock(DefaultBlockchain.class));
when(besuController.getProtocolManager()).thenReturn(ethProtocolManager);
when(besuController.getSubProtocolConfiguration()).thenReturn(subProtocolConfiguration);
when(besuController.getProtocolContext()).thenReturn(protocolContext);
when(besuController.getProtocolSchedule()).thenReturn(mock(ProtocolSchedule.class));
when(besuController.getNodeKey()).thenReturn(nodeKey);
when(besuController.getMiningParameters()).thenReturn(mock(MiningParameters.class));
when(besuController.getPrivacyParameters()).thenReturn(mock(PrivacyParameters.class));
when(besuController.getTransactionPool()).thenReturn(mock(TransactionPool.class));
when(besuController.getSynchronizer()).thenReturn(mock(Synchronizer.class));
when(besuController.getMiningCoordinator()).thenReturn(mock(MiningCoordinator.class));
}
Aggregations