Remove ServiceBuilderCommand and implement the chain ops as standalone functions instead. (#6543)

* :)

* Slight tidy

* Remove ServiceBuilderCommand

* Remove whitespace

* Keep task manager alive for check_block/import_blocks

* Pass task_manager to run_until_exit

* Make task_manager in run_until_exit and make subcommands async

* Change the async_run fn to return a future and task manager

* async_run should take a result fn

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix spaces in export_raw_state

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Ashley
2020-07-02 12:57:56 +02:00
committed by GitHub
parent 424d5c722d
commit 5f751e4472
21 changed files with 960 additions and 805 deletions
@@ -22,7 +22,7 @@ use crate::params::SharedParams;
use crate::CliConfiguration;
use log::info;
use sc_network::config::build_multiaddr;
use sc_service::{config::MultiaddrWithPeerId, Configuration};
use sc_service::{config::{MultiaddrWithPeerId, NetworkConfiguration}, ChainSpec};
use structopt::StructOpt;
use std::io::Write;
@@ -51,13 +51,16 @@ pub struct BuildSpecCmd {
impl BuildSpecCmd {
/// Run the build-spec command
pub fn run(&self, config: Configuration) -> error::Result<()> {
pub fn run(
&self,
mut spec: Box<dyn ChainSpec>,
network_config: NetworkConfiguration,
) -> error::Result<()> {
info!("Building chain spec");
let mut spec = config.chain_spec;
let raw_output = self.raw;
if spec.boot_nodes().is_empty() && !self.disable_default_bootnode {
let keys = config.network.node_key.into_keypair()?;
let keys = network_config.node_key.into_keypair()?;
let peer_id = keys.public().into_peer_id();
let addr = MultiaddrWithPeerId {
multiaddr: build_multiaddr![Ip4([127, 0, 0, 1]), Tcp(30333u16)],