use of tech.pegasys.teku.networking.eth2.gossip.forks.GossipForkManager in project teku by ConsenSys.
the class Eth2P2PNetworkBuilder method build.
public Eth2P2PNetwork build() {
validate();
// Setup eth2 handlers
final SubnetSubscriptionService attestationSubnetService = new SubnetSubscriptionService();
final SubnetSubscriptionService syncCommitteeSubnetService = new SubnetSubscriptionService();
final RpcEncoding rpcEncoding = RpcEncoding.createSszSnappyEncoding(spec.isMilestoneSupported(SpecMilestone.BELLATRIX) ? MAX_CHUNK_SIZE_BELLATRIX : MAX_CHUNK_SIZE);
final Eth2PeerManager eth2PeerManager = Eth2PeerManager.create(asyncRunner, recentChainData, historicalChainData, metricsSystem, attestationSubnetService, syncCommitteeSubnetService, rpcEncoding, requiredCheckpoint, eth2RpcPingInterval, eth2RpcOutstandingPingThreshold, eth2StatusUpdateInterval, timeProvider, config.getPeerRateLimit(), config.getPeerRequestLimit(), spec);
final Collection<RpcMethod<?, ?, ?>> eth2RpcMethods = eth2PeerManager.getBeaconChainMethods().all();
rpcMethods.addAll(eth2RpcMethods);
peerHandlers.add(eth2PeerManager);
final GossipEncoding gossipEncoding = config.getGossipEncoding();
// Build core network and inject eth2 handlers
final DiscoveryNetwork<?> network = buildNetwork(gossipEncoding, syncCommitteeSubnetService);
final GossipForkManager gossipForkManager = buildGossipForkManager(gossipEncoding, network);
return new ActiveEth2P2PNetwork(config.getSpec(), asyncRunner, network, eth2PeerManager, gossipForkManager, eventChannels, recentChainData, attestationSubnetService, syncCommitteeSubnetService, gossipEncoding, config.getGossipConfigurator(), processedAttestationSubscriptionProvider);
}
Aggregations