use of tech.pegasys.teku.api.ChainDataProvider in project teku by ConsenSys.
the class BeaconChainController method initValidatorApiHandler.
public void initValidatorApiHandler() {
LOG.debug("BeaconChainController.initValidatorApiHandler()");
final BlockFactory blockFactory = new BlockFactory(spec, new BlockOperationSelectorFactory(spec, attestationPool, attesterSlashingPool, proposerSlashingPool, voluntaryExitPool, syncCommitteeContributionPool, depositProvider, eth1DataCache, VersionProvider.getDefaultGraffiti(), forkChoiceNotifier, executionEngine));
SyncCommitteeSubscriptionManager syncCommitteeSubscriptionManager = beaconConfig.p2pConfig().isSubscribeAllSubnetsEnabled() ? new AllSyncCommitteeSubscriptions(p2pNetwork, spec) : new SyncCommitteeSubscriptionManager(p2pNetwork);
final BlockImportChannel blockImportChannel = eventChannels.getPublisher(BlockImportChannel.class, beaconAsyncRunner);
final BlockGossipChannel blockGossipChannel = eventChannels.getPublisher(BlockGossipChannel.class);
final ValidatorApiHandler validatorApiHandler = new ValidatorApiHandler(new ChainDataProvider(spec, recentChainData, combinedChainDataClient), combinedChainDataClient, syncService, blockFactory, blockImportChannel, blockGossipChannel, attestationPool, attestationManager, attestationTopicSubscriber, activeValidatorTracker, DutyMetrics.create(metricsSystem, timeProvider, recentChainData, spec), performanceTracker, spec, forkChoiceTrigger, forkChoiceNotifier, syncCommitteeMessagePool, syncCommitteeContributionPool, syncCommitteeSubscriptionManager);
eventChannels.subscribe(SlotEventsChannel.class, activeValidatorTracker).subscribeMultithreaded(ValidatorApiChannel.class, validatorApiHandler, beaconConfig.beaconRestApiConfig().getValidatorThreads());
// so don't subscribe.
if (!beaconConfig.p2pConfig().isSubscribeAllSubnetsEnabled()) {
eventChannels.subscribe(SlotEventsChannel.class, attestationTopicSubscriber).subscribe(SlotEventsChannel.class, syncCommitteeSubscriptionManager);
}
}
Aggregations