Search in sources :

Example 1 with IbftSubProtocol

use of org.hyperledger.besu.consensus.ibft.protocol.IbftSubProtocol 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));
}
Also used : EthContext(org.hyperledger.besu.ethereum.eth.manager.EthContext) TransactionPool(org.hyperledger.besu.ethereum.eth.transactions.TransactionPool) Synchronizer(org.hyperledger.besu.ethereum.core.Synchronizer) SECP256K1(org.hyperledger.besu.crypto.SECP256K1) BftProtocolManager(org.hyperledger.besu.consensus.common.bft.protocol.BftProtocolManager) IbftSubProtocol(org.hyperledger.besu.consensus.ibft.protocol.IbftSubProtocol) ProtocolSchedule(org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule) PrivacyParameters(org.hyperledger.besu.ethereum.core.PrivacyParameters) BftEventQueue(org.hyperledger.besu.consensus.common.bft.BftEventQueue) PoWMiningCoordinator(org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator) MergeMiningCoordinator(org.hyperledger.besu.consensus.merge.blockcreation.MergeMiningCoordinator) MiningCoordinator(org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator) EthProtocolManager(org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager) PeerConnectionTracker(org.hyperledger.besu.consensus.common.bft.network.PeerConnectionTracker) MiningParameters(org.hyperledger.besu.ethereum.core.MiningParameters) SubProtocolConfiguration(org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration) EthScheduler(org.hyperledger.besu.ethereum.eth.manager.EthScheduler) KeyPairSecurityModule(org.hyperledger.besu.crypto.KeyPairSecurityModule) ProtocolContext(org.hyperledger.besu.ethereum.ProtocolContext) DefaultBlockchain(org.hyperledger.besu.ethereum.chain.DefaultBlockchain) NodeKey(org.hyperledger.besu.crypto.NodeKey) Before(org.junit.Before)

Aggregations

BftEventQueue (org.hyperledger.besu.consensus.common.bft.BftEventQueue)1 PeerConnectionTracker (org.hyperledger.besu.consensus.common.bft.network.PeerConnectionTracker)1 BftProtocolManager (org.hyperledger.besu.consensus.common.bft.protocol.BftProtocolManager)1 IbftSubProtocol (org.hyperledger.besu.consensus.ibft.protocol.IbftSubProtocol)1 MergeMiningCoordinator (org.hyperledger.besu.consensus.merge.blockcreation.MergeMiningCoordinator)1 KeyPairSecurityModule (org.hyperledger.besu.crypto.KeyPairSecurityModule)1 NodeKey (org.hyperledger.besu.crypto.NodeKey)1 SECP256K1 (org.hyperledger.besu.crypto.SECP256K1)1 ProtocolContext (org.hyperledger.besu.ethereum.ProtocolContext)1 MiningCoordinator (org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator)1 PoWMiningCoordinator (org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator)1 DefaultBlockchain (org.hyperledger.besu.ethereum.chain.DefaultBlockchain)1 MiningParameters (org.hyperledger.besu.ethereum.core.MiningParameters)1 PrivacyParameters (org.hyperledger.besu.ethereum.core.PrivacyParameters)1 Synchronizer (org.hyperledger.besu.ethereum.core.Synchronizer)1 EthContext (org.hyperledger.besu.ethereum.eth.manager.EthContext)1 EthProtocolManager (org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager)1 EthScheduler (org.hyperledger.besu.ethereum.eth.manager.EthScheduler)1 TransactionPool (org.hyperledger.besu.ethereum.eth.transactions.TransactionPool)1 ProtocolSchedule (org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule)1