mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 06:17:56 +00:00
Move syncing code from sc-network-common to sc-network-sync (#1912)
This PR moves syncing-related code from `sc-network-common` to `sc-network-sync`. Unfortunately, some parts are tightly integrated with networking, so they were left in `sc-network-common` for now: 1. `SyncMode` in `common/src/sync.rs` (used in `NetworkConfiguration`). 2. `BlockAnnouncesHandshake`, `BlockRequest`, `BlockResponse`, etc. in `common/src/sync/message.rs` (used in `src/protocol.rs` and `src/protocol/message.rs`). More substantial refactoring is needed to decouple syncing and networking completely, including getting rid of the hardcoded sync protocol. ## Release notes Move syncing-related code from `sc-network-common` to `sc-network-sync`. Delete `ChainSync` trait as it's never used (the only implementation is accessed directly from `SyncingEngine` and exposes a lot of public methods that are not part of the trait). Some new trait(s) for syncing will likely be introduced as part of Sync 2.0 refactoring to represent syncing strategies.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
//! [`PendingResponses`] is responsible for keeping track of pending responses and
|
||||
//! polling them.
|
||||
|
||||
use crate::types::PeerRequest;
|
||||
use futures::{
|
||||
channel::oneshot,
|
||||
future::BoxFuture,
|
||||
@@ -28,11 +29,13 @@ use futures::{
|
||||
use libp2p::PeerId;
|
||||
use log::error;
|
||||
use sc_network::request_responses::RequestFailure;
|
||||
use sc_network_common::sync::PeerRequest;
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
use std::task::{Context, Poll};
|
||||
use tokio_stream::StreamMap;
|
||||
|
||||
/// Log target for this file.
|
||||
const LOG_TARGET: &'static str = "sync";
|
||||
|
||||
/// Response result.
|
||||
type ResponseResult = Result<Result<Vec<u8>, RequestFailure>, oneshot::Canceled>;
|
||||
|
||||
@@ -74,7 +77,7 @@ impl<B: BlockT> PendingResponses<B> {
|
||||
.is_some()
|
||||
{
|
||||
error!(
|
||||
target: crate::LOG_TARGET,
|
||||
target: LOG_TARGET,
|
||||
"Discarded pending response from peer {peer_id}, request type: {request_type:?}.",
|
||||
);
|
||||
debug_assert!(false);
|
||||
|
||||
Reference in New Issue
Block a user