use of tech.pegasys.teku.statetransition.BeaconChainUtil in project teku by ConsenSys.
the class NodeManager method create.
public static NodeManager create(final Spec spec, Eth2P2PNetworkFactory networkFactory, final List<BLSKeyPair> validatorKeys, Consumer<Eth2P2PNetworkBuilder> configureNetwork) throws Exception {
final EventChannels eventChannels = EventChannels.createSyncChannels(ChannelExceptionHandler.THROWING_HANDLER, new NoOpMetricsSystem());
final RecentChainData storageClient = MemoryOnlyRecentChainData.create(spec);
final BeaconChainUtil chainUtil = BeaconChainUtil.create(spec, storageClient, validatorKeys);
chainUtil.initializeStorage();
final Eth2P2PNetworkBuilder networkBuilder = networkFactory.builder().spec(spec).eventChannels(eventChannels).recentChainData(storageClient);
configureNetwork.accept(networkBuilder);
final BlockGossipChannel blockGossipChannel = eventChannels.getPublisher(BlockGossipChannel.class);
final Eth2P2PNetwork eth2P2PNetwork = networkBuilder.startNetwork();
return new NodeManager(blockGossipChannel, storageClient, chainUtil, eth2P2PNetwork);
}
Aggregations