use of tech.pegasys.teku.storage.api.StorageUpdateChannel in project teku by ConsenSys.
the class BeaconChainController method initialize.
protected SafeFuture<?> initialize() {
final StoreConfig storeConfig = beaconConfig.storeConfig();
coalescingChainHeadChannel = new CoalescingChainHeadChannel(eventChannels.getPublisher(ChainHeadChannel.class), EVENT_LOG);
StorageQueryChannel storageQueryChannel = eventChannels.getPublisher(StorageQueryChannel.class, beaconAsyncRunner);
StorageUpdateChannel storageUpdateChannel = eventChannels.getPublisher(StorageUpdateChannel.class, beaconAsyncRunner);
final VoteUpdateChannel voteUpdateChannel = eventChannels.getPublisher(VoteUpdateChannel.class);
return initWeakSubjectivity(storageQueryChannel, storageUpdateChannel).thenCompose(__ -> StorageBackedRecentChainData.create(metricsSystem, storeConfig, beaconAsyncRunner, storageQueryChannel, storageUpdateChannel, voteUpdateChannel, eventChannels.getPublisher(FinalizedCheckpointChannel.class, beaconAsyncRunner), coalescingChainHeadChannel, spec)).thenCompose(client -> {
// Setup chain storage
this.recentChainData = client;
if (recentChainData.isPreGenesis()) {
setupInitialState(client);
} else if (beaconConfig.eth2NetworkConfig().isUsingCustomInitialState()) {
STATUS_LOG.warnInitialStateIgnored();
}
return SafeFuture.completedFuture(client);
}).thenAccept(client -> {
// Init other services
this.initAll();
eventChannels.subscribe(TimeTickChannel.class, this);
recentChainData.subscribeStoreInitialized(this::onStoreInitialized);
recentChainData.subscribeBestBlockInitialized(this::startServices);
});
}
Aggregations