Add --collator flag as alternative to --validator (#222)

* Initial commit

Forked at: 56753b7717
Parent branch: origin/master

* Add --collator flag as alternative to --validator

* Apply suggestions from code review

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:
Cecile Tonglet
2020-10-02 12:24:20 +02:00
committed by GitHub
parent 56753b7717
commit ba44e83f68
2 changed files with 10 additions and 3 deletions
+6
View File
@@ -93,6 +93,12 @@ pub struct Cli {
#[structopt(flatten)] #[structopt(flatten)]
pub run: RunCmd, 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 /// Relaychain arguments
#[structopt(raw = true)] #[structopt(raw = true)]
pub relaychain_args: Vec<String>, pub relaychain_args: Vec<String>,
+4 -3
View File
@@ -276,13 +276,14 @@ pub fn run() -> Result<()> {
let polkadot_config = let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, task_executor) SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, task_executor)
.map_err(|err| format!("Relay chain argument error: {}", err))?; .map_err(|err| format!("Relay chain argument error: {}", err))?;
let collator = cli.run.base.validator || cli.collator;
info!("Parachain id: {:?}", id); info!("Parachain id: {:?}", id);
info!("Parachain Account: {}", parachain_account); info!("Parachain Account: {}", parachain_account);
info!("Parachain genesis state: {}", genesis_state); info!("Parachain genesis state: {}", genesis_state);
info!( info!(
"Is collating: {}", "Is collating: {}",
if cli.run.base.validator { "yes" } else { "no" } if collator { "yes" } else { "no" }
); );
if use_contracts_runtime(&config.chain_spec) { if use_contracts_runtime(&config.chain_spec) {
@@ -291,7 +292,7 @@ pub fn run() -> Result<()> {
key, key,
polkadot_config, polkadot_config,
id, id,
cli.run.base.validator, collator,
false, false,
) )
} else { } else {
@@ -300,7 +301,7 @@ pub fn run() -> Result<()> {
key, key,
polkadot_config, polkadot_config,
id, id,
cli.run.base.validator, collator,
false, false,
) )
.map(|r| r.0) .map(|r| r.0)