Move requests-responses and polling from ChainSync to SyncingEngine (#1650)

Move request-response handling from `ChainSync` to `SyncingEngine` as
part of [Sync
2.0](https://github.com/paritytech/polkadot-sdk/issues/534) refactoring
aimed at making `ChainSync` a pure state machine.

Resolves https://github.com/paritytech/polkadot-sdk/issues/502.

---------

Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Dmitry Markin
2023-09-27 19:44:37 +03:00
committed by GitHub
parent 02284a3e82
commit 14e5d23348
8 changed files with 608 additions and 542 deletions
+1 -11
View File
@@ -20,7 +20,7 @@
use crate::block_relay_protocol::{BlockDownloader as BlockDownloaderT, BlockResponseError};
use futures::{channel::oneshot, task::Poll};
use futures::channel::oneshot;
use libp2p::PeerId;
use sc_network::RequestFailure;
use sc_network_common::sync::{
@@ -39,7 +39,6 @@ mockall::mock! {
fn num_sync_requests(&self) -> usize;
fn num_downloaded_blocks(&self) -> usize;
fn num_peers(&self) -> usize;
fn num_active_peers(&self) -> usize;
fn new_peer(
&mut self,
who: PeerId,
@@ -81,15 +80,6 @@ mockall::mock! {
);
fn peer_disconnected(&mut self, who: &PeerId);
fn metrics(&self) -> Metrics;
fn poll<'a>(
&mut self,
cx: &mut std::task::Context<'a>,
) -> Poll<()>;
fn send_block_request(
&mut self,
who: PeerId,
request: BlockRequest<Block>,
);
}
}