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

Commit

Permalink
use |config|
Browse files Browse the repository at this point in the history
  • Loading branch information
expenses committed Jun 24, 2020
1 parent f42df6c commit 0ad4e40
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
13 changes: 7 additions & 6 deletions bin/node-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ pub fn run() -> sc_cli::Result<()> {
}
None => {
let runner = cli.create_runner(&cli.run)?;
runner.print_node_infos(node_template_runtime::VERSION);
let service_fn = match runner.config().role {
Role::Light => service::new_light,
_ => service::new_full,
};
runner.run_node_until_exit(service_fn)
runner.run_node_until_exit(
|config| match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config),
},
node_template_runtime::VERSION,
)
}
}
}
13 changes: 7 additions & 6 deletions bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ pub fn run() -> Result<()> {
match &cli.subcommand {
None => {
let runner = cli.create_runner(&cli.run)?;
runner.print_node_infos(node_runtime::VERSION);
let service_fn = match runner.config().role {
Role::Light => service::new_light,
_ => service::new_full,
};
runner.run_node_until_exit(service_fn)
runner.run_node_until_exit(
|config| match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config),
},
node_runtime::VERSION,
)
}
Some(Subcommand::Inspect(cmd)) => {
let runner = cli.create_runner(cmd)?;
Expand Down
4 changes: 3 additions & 1 deletion client/cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl<C: SubstrateCli> Runner<C> {
/// 2020-06-03 16:14:21 💾 Database: RocksDb at /tmp/c/chains/flamingfir7/db
/// 2020-06-03 16:14:21 ⛓ Native runtime: node-251 (substrate-node-1.tx1.au10)
/// ```
pub fn print_node_infos(&self, runtime_version: RuntimeVersion) {
fn print_node_infos(&self, runtime_version: RuntimeVersion) {
info!("{}", C::impl_name());
info!("✌️ version {}", C::impl_version());
info!(
Expand Down Expand Up @@ -205,7 +205,9 @@ impl<C: SubstrateCli> Runner<C> {
pub fn run_node_until_exit(
mut self,
initialise: impl FnOnce(Configuration) -> sc_service::error::Result<TaskManager>,
runtime_version: RuntimeVersion,
) -> Result<()> {
self.print_node_infos(runtime_version);
let mut task_manager = initialise(self.config)?;
self.tokio_runtime.block_on(main(task_manager.future().fuse()))
.map_err(|e| e.to_string())?;
Expand Down

0 comments on commit 0ad4e40

Please sign in to comment.