Cleanup the exports of sc-network (#4983)

* Cleanup the exports of sc-network

* Fix RPC tests

* Revert moving the NetworkStateInfo trait

* Fix GrandPa tests
This commit is contained in:
Pierre Krieger
2020-02-19 16:52:39 +01:00
committed by GitHub
parent 6da156dc53
commit 1489397f7b
15 changed files with 158 additions and 134 deletions
@@ -30,7 +30,7 @@ use sp_blockchain::Error as ClientError;
use sc_client_api::{FetchChecker, RemoteHeaderRequest,
RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, ChangesProof,
RemoteReadChildRequest, RemoteBodyRequest, StorageProof};
use crate::message::{self, BlockAttributes, Direction, FromBlock, RequestId};
use crate::protocol::message::{self, BlockAttributes, Direction, FromBlock, RequestId};
use libp2p::PeerId;
use crate::config::Roles;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
@@ -28,7 +28,7 @@ pub trait NetworkSpecialization<B: BlockT>: Send + Sync + 'static {
fn status(&self) -> Vec<u8>;
/// Called when a peer successfully handshakes.
fn on_connect(&mut self, ctx: &mut dyn Context<B>, who: PeerId, status: crate::message::Status<B>);
fn on_connect(&mut self, ctx: &mut dyn Context<B>, who: PeerId, status: crate::protocol::message::Status<B>);
/// Called when a peer is disconnected. If the peer ID is unknown, it should be ignored.
fn on_disconnect(&mut self, ctx: &mut dyn Context<B>, who: PeerId);
@@ -62,7 +62,7 @@ impl<B: BlockT> NetworkSpecialization<B> for DummySpecialization {
&mut self,
_ctx: &mut dyn Context<B>,
_peer_id: PeerId,
_status: crate::message::Status<B>
_status: crate::protocol::message::Status<B>
) {}
fn on_disconnect(&mut self, _ctx: &mut dyn Context<B>, _peer_id: PeerId) {}
@@ -35,7 +35,7 @@ use sp_consensus::{BlockOrigin, BlockStatus,
};
use crate::{
config::{Roles, BoxFinalityProofRequestBuilder},
message::{self, generic::FinalityProofRequest, BlockAnnounce, BlockAttributes, BlockRequest, BlockResponse,
protocol::message::{self, generic::FinalityProofRequest, BlockAnnounce, BlockAttributes, BlockRequest, BlockResponse,
FinalityProofResponse},
};
use either::Either;
@@ -22,7 +22,7 @@ use std::collections::hash_map::Entry;
use log::trace;
use libp2p::PeerId;
use sp_runtime::traits::{Block as BlockT, NumberFor, One};
use crate::message;
use crate::protocol::message;
/// Block data with origin.
#[derive(Debug, Clone, PartialEq, Eq)]