use of tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread in project teku by ConsenSys.
the class MultipeerSyncService method create.
public static MultipeerSyncService create(final AsyncRunnerFactory asyncRunnerFactory, final AsyncRunner asyncRunner, final TimeProvider timeProvider, final RecentChainData recentChainData, final PendingPool<SignedBeaconBlock> pendingBlocks, final P2PNetwork<Eth2Peer> p2pNetwork, final BlockImporter blockImporter, final Spec spec) {
LOG.info("Using multipeer sync");
final EventThread eventThread = new AsyncRunnerEventThread("sync", asyncRunnerFactory);
final TargetChains finalizedTargetChains = new TargetChains();
final TargetChains nonfinalizedTargetChains = new TargetChains();
final BatchSync batchSync = BatchSync.create(eventThread, asyncRunner, recentChainData, new BatchImporter(blockImporter, asyncRunner), new BatchFactory(eventThread, new PeerScoringConflictResolutionStrategy()), Constants.SYNC_BATCH_SIZE, MultipeerCommonAncestorFinder.create(recentChainData, eventThread, spec), timeProvider);
final SyncController syncController = new SyncController(eventThread, new OrderedAsyncRunner(asyncRunner), recentChainData, new SyncTargetSelector(recentChainData, pendingBlocks, finalizedTargetChains, nonfinalizedTargetChains, spec.getSlotsPerEpoch(recentChainData.getCurrentSlot().orElse(UInt64.ZERO))), batchSync);
final PeerChainTracker peerChainTracker = new PeerChainTracker(recentChainData.getSpec(), eventThread, p2pNetwork, new SyncSourceFactory(asyncRunner, timeProvider), finalizedTargetChains, nonfinalizedTargetChains);
peerChainTracker.subscribeToTargetChainUpdates(syncController::onTargetChainsUpdated);
final SyncStallDetector syncStallDetector = new SyncStallDetector(spec, eventThread, asyncRunner, timeProvider, syncController, batchSync, recentChainData);
return new MultipeerSyncService(eventThread, recentChainData, peerChainTracker, syncController, syncStallDetector);
}
use of tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread in project teku by ConsenSys.
the class ForkChoiceNotifierImpl method create.
public static ForkChoiceNotifier create(final AsyncRunnerFactory asyncRunnerFactory, final Spec spec, final ExecutionEngineChannel executionEngineChannel, final RecentChainData recentChainData, final Optional<? extends Bytes20> proposerDefaultFeeRecipient) {
final AsyncRunnerEventThread eventThread = new AsyncRunnerEventThread("forkChoiceNotifier", asyncRunnerFactory);
eventThread.start();
return new ForkChoiceNotifierImpl(eventThread, spec, executionEngineChannel, recentChainData, new PayloadAttributesCalculator(spec, eventThread, recentChainData, proposerDefaultFeeRecipient));
}
Aggregations