use of tech.pegasys.teku.beaconrestapi.BeaconRestApi in project teku by ConsenSys.
the class BeaconChainController method initRestAPI.
public void initRestAPI() {
LOG.debug("BeaconChainController.initRestAPI()");
final DataProvider dataProvider = DataProvider.builder().spec(spec).recentChainData(recentChainData).combinedChainDataClient(combinedChainDataClient).p2pNetwork(p2pNetwork).syncService(syncService).validatorApiChannel(eventChannels.getPublisher(ValidatorApiChannel.class, beaconAsyncRunner)).attestationPool(attestationPool).blockManager(blockManager).attestationManager(attestationManager).isLivenessTrackingEnabled(beaconConfig.beaconRestApiConfig().isBeaconLivenessTrackingEnabled()).activeValidatorChannel(eventChannels.getPublisher(ActiveValidatorChannel.class, beaconAsyncRunner)).attesterSlashingPool(attesterSlashingPool).proposerSlashingPool(proposerSlashingPool).voluntaryExitPool(voluntaryExitPool).syncCommitteeContributionPool(syncCommitteeContributionPool).payloadAttributesCalculator(Optional.of(forkChoiceNotifier.getPayloadAttributesCalculator())).build();
if (beaconConfig.beaconRestApiConfig().isRestApiEnabled()) {
beaconRestAPI = Optional.of(new BeaconRestApi(dataProvider, beaconConfig.beaconRestApiConfig(), eventChannels, eventAsyncRunner));
if (beaconConfig.beaconRestApiConfig().isBeaconLivenessTrackingEnabled()) {
final int initialValidatorsCount = spec.getGenesisSpec().getConfig().getMinGenesisActiveValidatorCount();
eventChannels.subscribe(ActiveValidatorChannel.class, new ActiveValidatorCache(spec, initialValidatorsCount));
}
} else {
LOG.info("rest-api-enabled is false, not starting rest api.");
}
}
Aggregations