Search in sources :

Example 1 with StatusMessageFactory

use of tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.StatusMessageFactory in project teku by ConsenSys.

the class BeaconChainMethods method createStatus.

private static Eth2RpcMethod<StatusMessage, StatusMessage> createStatus(final AsyncRunner asyncRunner, final StatusMessageFactory statusMessageFactory, final PeerLookup peerLookup, final RpcEncoding rpcEncoding) {
    final StatusMessageHandler statusHandler = new StatusMessageHandler(statusMessageFactory);
    final RpcContextCodec<?, StatusMessage> contextCodec = RpcContextCodec.noop(StatusMessage.SSZ_SCHEMA);
    return new SingleProtocolEth2RpcMethod<>(asyncRunner, BeaconChainMethodIds.STATUS, 1, rpcEncoding, StatusMessage.SSZ_SCHEMA, true, contextCodec, statusHandler, peerLookup);
}
Also used : SingleProtocolEth2RpcMethod(tech.pegasys.teku.networking.eth2.rpc.core.methods.SingleProtocolEth2RpcMethod) StatusMessageHandler(tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.StatusMessageHandler) StatusMessage(tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.StatusMessage)

Example 2 with StatusMessageFactory

use of tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.StatusMessageFactory in project teku by ConsenSys.

the class Eth2PeerManager method create.

public static Eth2PeerManager create(final AsyncRunner asyncRunner, final RecentChainData recentChainData, final StorageQueryChannel historicalChainData, final MetricsSystem metricsSystem, final SubnetSubscriptionService attestationSubnetService, final SubnetSubscriptionService syncCommitteeSubnetService, final RpcEncoding rpcEncoding, final Optional<Checkpoint> requiredCheckpoint, final Duration eth2RpcPingInterval, final int eth2RpcOutstandingPingThreshold, final Duration eth2StatusUpdateInterval, final TimeProvider timeProvider, final int peerRateLimit, final int peerRequestLimit, final Spec spec) {
    final StatusMessageFactory statusMessageFactory = new StatusMessageFactory(recentChainData);
    final MetadataMessagesFactory metadataMessagesFactory = new MetadataMessagesFactory();
    attestationSubnetService.subscribeToUpdates(metadataMessagesFactory::updateAttestationSubnetIds);
    syncCommitteeSubnetService.subscribeToUpdates(metadataMessagesFactory::updateSyncCommitteeSubnetIds);
    final CombinedChainDataClient combinedChainDataClient = new CombinedChainDataClient(recentChainData, historicalChainData, spec);
    return new Eth2PeerManager(spec, asyncRunner, combinedChainDataClient, recentChainData, metricsSystem, new Eth2PeerFactory(spec, metricsSystem, combinedChainDataClient, statusMessageFactory, metadataMessagesFactory, timeProvider, requiredCheckpoint, peerRateLimit, peerRequestLimit), statusMessageFactory, metadataMessagesFactory, rpcEncoding, eth2RpcPingInterval, eth2RpcOutstandingPingThreshold, eth2StatusUpdateInterval);
}
Also used : MetadataMessagesFactory(tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.MetadataMessagesFactory) CombinedChainDataClient(tech.pegasys.teku.storage.client.CombinedChainDataClient) StatusMessageFactory(tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.StatusMessageFactory)

Aggregations

MetadataMessagesFactory (tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.MetadataMessagesFactory)1 StatusMessageFactory (tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.StatusMessageFactory)1 StatusMessageHandler (tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.StatusMessageHandler)1 SingleProtocolEth2RpcMethod (tech.pegasys.teku.networking.eth2.rpc.core.methods.SingleProtocolEth2RpcMethod)1 StatusMessage (tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.StatusMessage)1 CombinedChainDataClient (tech.pegasys.teku.storage.client.CombinedChainDataClient)1