From ba44e83f682870bf1faa4dafb8c4078e0aeb01ff Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Fri, 2 Oct 2020 12:24:20 +0200 Subject: [PATCH] Add --collator flag as alternative to --validator (#222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit Forked at: 56753b7717a624215703c0fdd9be0231e949fb86 Parent branch: origin/master * Add --collator flag as alternative to --validator * Apply suggestions from code review Co-authored-by: Bastian Köcher Co-authored-by: Bastian Köcher --- cumulus/rococo-parachains/src/cli.rs | 6 ++++++ cumulus/rococo-parachains/src/command.rs | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cumulus/rococo-parachains/src/cli.rs b/cumulus/rococo-parachains/src/cli.rs index ec51056ef6..fd033baa4b 100644 --- a/cumulus/rococo-parachains/src/cli.rs +++ b/cumulus/rococo-parachains/src/cli.rs @@ -93,6 +93,12 @@ pub struct Cli { #[structopt(flatten)] pub run: RunCmd, + /// Run node as collator. + /// + /// Note that this is the same as running with `--validator`. + #[structopt(long, conflicts_with = "validator")] + pub collator: bool, + /// Relaychain arguments #[structopt(raw = true)] pub relaychain_args: Vec, diff --git a/cumulus/rococo-parachains/src/command.rs b/cumulus/rococo-parachains/src/command.rs index a9b0dd8e91..d374c1b0b4 100644 --- a/cumulus/rococo-parachains/src/command.rs +++ b/cumulus/rococo-parachains/src/command.rs @@ -276,13 +276,14 @@ pub fn run() -> Result<()> { let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, 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 cli.run.base.validator { "yes" } else { "no" } + if collator { "yes" } else { "no" } ); if use_contracts_runtime(&config.chain_spec) { @@ -291,7 +292,7 @@ pub fn run() -> Result<()> { key, polkadot_config, id, - cli.run.base.validator, + collator, false, ) } else { @@ -300,7 +301,7 @@ pub fn run() -> Result<()> { key, polkadot_config, id, - cli.run.base.validator, + collator, false, ) .map(|r| r.0)