Search in sources :

Example 1 with GossipForkManager

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);
}
Also used : GossipForkManager(tech.pegasys.teku.networking.eth2.gossip.forks.GossipForkManager) RpcMethod(tech.pegasys.teku.networking.p2p.rpc.RpcMethod) GossipEncoding(tech.pegasys.teku.networking.eth2.gossip.encoding.GossipEncoding) Eth2PeerManager(tech.pegasys.teku.networking.eth2.peers.Eth2PeerManager) RpcEncoding(tech.pegasys.teku.networking.eth2.rpc.core.encodings.RpcEncoding)

Aggregations

GossipEncoding (tech.pegasys.teku.networking.eth2.gossip.encoding.GossipEncoding)1 GossipForkManager (tech.pegasys.teku.networking.eth2.gossip.forks.GossipForkManager)1 Eth2PeerManager (tech.pegasys.teku.networking.eth2.peers.Eth2PeerManager)1 RpcEncoding (tech.pegasys.teku.networking.eth2.rpc.core.encodings.RpcEncoding)1 RpcMethod (tech.pegasys.teku.networking.p2p.rpc.RpcMethod)1