diff --git a/polkadot/service/src/lib.rs b/polkadot/service/src/lib.rs index ed650ae680..45be076dc1 100644 --- a/polkadot/service/src/lib.rs +++ b/polkadot/service/src/lib.rs @@ -60,6 +60,7 @@ pub use client::ExecutionStrategy; pub type ChainSpec = service::ChainSpec; /// Polkadot client type for specialised `Components`. pub type ComponentClient = Client<::Backend, ::Executor, Block>; +pub type NetworkService = network::Service::NetworkProtocol>; /// A collection of type to generalise Polkadot specific components over full / light client. pub trait Components: service::Components { @@ -134,6 +135,7 @@ impl service::ServiceFactory for Factory { pub struct Service { inner: service::Service, client: Arc>, + network: Arc, api: Arc<::Api>, _consensus: Option, } @@ -143,6 +145,10 @@ impl Service { self.client.clone() } + pub fn network(&self) -> Arc { + self.network.clone() + } + pub fn api(&self) -> Arc<::Api> { self.api.clone() } @@ -156,6 +162,7 @@ pub fn new_light(config: Configuration, executor: TaskExecutor) let api = Arc::new(RemotePolkadotApiWrapper(service.client())); Ok(Service { client: service.client(), + network: service.network(), api: api, inner: service, _consensus: None, @@ -192,6 +199,7 @@ pub fn new_full(config: Configuration, executor: TaskExecutor) Ok(Service { client: service.client(), + network: service.network(), api: service.client(), inner: service, _consensus: consensus,