Make --collator reusable and imply --validator (#380)

* Reusable RunCmd struct

* wire new run command through service

* Fill in the rest of the methods

* attempt normalization

* Settle on the borrowing approach

* add the normalize call

* bump substrate

* Update client/cli/src/lib.rs

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

* Update docs

* Update client/cli/src/lib.rs

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

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Joshy Orndorff
2021-05-06 10:38:25 -04:00
committed by GitHub
parent 5847e78fd9
commit 2641c5b830
5 changed files with 299 additions and 193 deletions
+4 -5
View File
@@ -262,7 +262,7 @@ pub fn run() -> Result<()> {
Ok(())
}
None => {
let runner = cli.create_runner(&*cli.run)?;
let runner = cli.create_runner(&cli.run.normalize())?;
let use_shell = use_shell_runtime(&runner.config().chain_spec);
runner.run_node_until_exit(|config| async move {
@@ -295,20 +295,19 @@ pub fn run() -> Result<()> {
task_executor,
)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
let collator = cli.run.base.validator || cli.collator;
info!("Parachain id: {:?}", id);
info!("Parachain Account: {}", parachain_account);
info!("Parachain genesis state: {}", genesis_state);
info!("Is collating: {}", if collator { "yes" } else { "no" });
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
if use_shell {
crate::service::start_shell_node(config, key, polkadot_config, id, collator)
crate::service::start_shell_node(config, key, polkadot_config, id)
.await
.map(|r| r.0)
.map_err(Into::into)
} else {
crate::service::start_node(config, key, polkadot_config, id, collator)
crate::service::start_node(config, key, polkadot_config, id)
.await
.map(|r| r.0)
.map_err(Into::into)