Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix browser node compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
expenses committed Jun 19, 2020
1 parent 0e6406d commit f4a52a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cli/src/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ async fn start_inner(chain_spec: String, log_level: String) -> Result<Client, Bo
info!("👤 Role: {}", config.display_role());

// Create the service. This is the most heavy initialization step.
let service = service::kusama_new_light(config)
let (keep_alive, rpc_handlers) = service::kusama_new_light(config)
.map_err(|e| format!("{:?}", e))?;

Ok(browser_utils::start_client(service))
Ok(browser_utils::start_client(keep_alive.task_manager, rpc_handlers))
}
6 changes: 3 additions & 3 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn run() -> Result<()> {

runtime.run_node(
|config| {
service::kusama_new_light(config)
service::kusama_new_light(config).map(|(components, _)| components)
},
|config| {
service::kusama_new_full(
Expand All @@ -136,7 +136,7 @@ pub fn run() -> Result<()> {
} else if chain_spec.is_westend() {
runtime.run_node(
|config| {
service::westend_new_light(config)
service::westend_new_light(config).map(|(components, _)| components)
},
|config| {
service::westend_new_full(
Expand All @@ -154,7 +154,7 @@ pub fn run() -> Result<()> {
} else {
runtime.run_node(
|config| {
service::polkadot_new_light(config)
service::polkadot_new_light(config).map(|(components, _)| components)
},
|config| {
service::polkadot_new_full(
Expand Down
23 changes: 16 additions & 7 deletions service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
use sc_executor::native_executor_instance;
use log::info;
pub use service::{
Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis,
Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis, RpcHandlers,
TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor,
Configuration, ChainSpec, ServiceBuilderCommand, ServiceComponents, KeepAliveServiceComponents,
};
Expand Down Expand Up @@ -635,9 +635,12 @@ macro_rules! new_light {
})?
.build_light()
.map(|ServiceComponents { task_manager, telemetry, base_path, rpc, rpc_handlers, .. }| {
KeepAliveServiceComponents {
task_manager, other: Box::new((telemetry, base_path, rpc, rpc_handlers))
}
(
KeepAliveServiceComponents {
task_manager, other: Box::new((telemetry, base_path, rpc))
},
rpc_handlers,
)
})
}}
}
Expand Down Expand Up @@ -777,19 +780,25 @@ pub struct FullNodeHandles {
}

/// Create a new Polkadot service for a light client.
pub fn polkadot_new_light(mut config: Configuration) -> Result<KeepAliveServiceComponents, ServiceError>
pub fn polkadot_new_light(mut config: Configuration) -> Result<
(KeepAliveServiceComponents, RpcHandlers), ServiceError
>
{
new_light!(config, polkadot_runtime::RuntimeApi, PolkadotExecutor)
}

/// Create a new Kusama service for a light client.
pub fn kusama_new_light(mut config: Configuration) -> Result<KeepAliveServiceComponents, ServiceError>
pub fn kusama_new_light(mut config: Configuration) -> Result<
(KeepAliveServiceComponents, RpcHandlers), ServiceError
>
{
new_light!(config, kusama_runtime::RuntimeApi, KusamaExecutor)
}

/// Create a new Westend service for a light client.
pub fn westend_new_light(mut config: Configuration, ) -> Result<KeepAliveServiceComponents, ServiceError>
pub fn westend_new_light(mut config: Configuration, ) -> Result<
(KeepAliveServiceComponents, RpcHandlers), ServiceError
>
{
new_light!(config, westend_runtime::RuntimeApi, KusamaExecutor)
}

0 comments on commit f4a52a3

Please sign in to comment.