Search in sources :

Example 1 with AsyncRunnerEventThread

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);
}
Also used : BatchFactory(tech.pegasys.teku.beacon.sync.forward.multipeer.batches.BatchFactory) SyncSourceFactory(tech.pegasys.teku.beacon.sync.forward.multipeer.chains.SyncSourceFactory) OrderedAsyncRunner(tech.pegasys.teku.infrastructure.async.OrderedAsyncRunner) AsyncRunnerEventThread(tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread) PeerScoringConflictResolutionStrategy(tech.pegasys.teku.beacon.sync.forward.multipeer.batches.PeerScoringConflictResolutionStrategy) TargetChains(tech.pegasys.teku.beacon.sync.forward.multipeer.chains.TargetChains) EventThread(tech.pegasys.teku.infrastructure.async.eventthread.EventThread) AsyncRunnerEventThread(tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread) PeerChainTracker(tech.pegasys.teku.beacon.sync.forward.multipeer.chains.PeerChainTracker)

Example 2 with AsyncRunnerEventThread

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));
}
Also used : AsyncRunnerEventThread(tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread)

Aggregations

AsyncRunnerEventThread (tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread)2 BatchFactory (tech.pegasys.teku.beacon.sync.forward.multipeer.batches.BatchFactory)1 PeerScoringConflictResolutionStrategy (tech.pegasys.teku.beacon.sync.forward.multipeer.batches.PeerScoringConflictResolutionStrategy)1 PeerChainTracker (tech.pegasys.teku.beacon.sync.forward.multipeer.chains.PeerChainTracker)1 SyncSourceFactory (tech.pegasys.teku.beacon.sync.forward.multipeer.chains.SyncSourceFactory)1 TargetChains (tech.pegasys.teku.beacon.sync.forward.multipeer.chains.TargetChains)1 OrderedAsyncRunner (tech.pegasys.teku.infrastructure.async.OrderedAsyncRunner)1 EventThread (tech.pegasys.teku.infrastructure.async.eventthread.EventThread)1