diff --git a/substrate/node/cli/src/lib.rs b/substrate/node/cli/src/lib.rs index 70980b495d..2be8313404 100644 --- a/substrate/node/cli/src/lib.rs +++ b/substrate/node/cli/src/lib.rs @@ -120,21 +120,10 @@ pub fn run(args: I, exit: E, version: cli::VersionInfo) -> error::Resul Err(e) => e.exit(), }; - let (spec, mut config) = cli::parse_matches::( + let (spec, config) = cli::parse_matches::( load_spec, version, "substrate-node", &matches )?; - if matches.is_present("grandpa_authority_only") { - config.custom.grandpa_authority = true; - config.custom.grandpa_authority_only = true; - // Authority Setup is only called if validator is set as true - config.roles = ServiceRoles::AUTHORITY; - } else if matches.is_present("grandpa_authority") { - config.custom.grandpa_authority = true; - // Authority Setup is only called if validator is set as true - config.roles = ServiceRoles::AUTHORITY; - } - match cli::execute_default::(spec, exit, &matches, &config)? { cli::Action::ExecutedInternally => (), cli::Action::RunService(exit) => { diff --git a/substrate/node/cli/src/params.rs b/substrate/node/cli/src/params.rs index f092887587..130c9a4dc5 100644 --- a/substrate/node/cli/src/params.rs +++ b/substrate/node/cli/src/params.rs @@ -20,14 +20,6 @@ use cli::CoreParams; /// Extend params for Node #[derive(Debug, StructOpt)] pub struct Params { - /// Should run as a GRANDPA authority node - #[structopt(long = "grandpa-authority", help = "Run Node as a GRANDPA authority, implies --validator")] - grandpa_authority: bool, - - /// Should run as a GRANDPA authority node only - #[structopt(long = "grandpa-authority-only", help = "Run Node as a GRANDPA authority only, don't as a usual validator, implies --grandpa-authority")] - grandpa_authority_only: bool, - #[structopt(flatten)] core: CoreParams } diff --git a/substrate/node/cli/src/service.rs b/substrate/node/cli/src/service.rs index 393b2a480c..f4796343b5 100644 --- a/substrate/node/cli/src/service.rs +++ b/substrate/node/cli/src/service.rs @@ -40,12 +40,7 @@ construct_simple_protocol! { /// Node specific configuration pub struct NodeConfig { - /// should run as a grandpa authority - pub grandpa_authority: bool, - /// should run as a grandpa authority only, don't validate as usual - pub grandpa_authority_only: bool, /// grandpa connection to import block - // FIXME: rather than putting this on the config, let's have an actual intermediate setup state // https://github.com/paritytech/substrate/issues/1134 pub grandpa_import_setup: Option<(Arc>, grandpa::LinkHalfForService)>, @@ -54,8 +49,6 @@ pub struct NodeConfig { impl Default for NodeConfig where F: substrate_service::ServiceFactory { fn default() -> NodeConfig { NodeConfig { - grandpa_authority: false, - grandpa_authority_only: false, grandpa_import_setup: None, } } @@ -77,38 +70,29 @@ construct_service_factory! { { |config: FactoryFullConfiguration, executor: TaskExecutor| FullComponents::::new(config, executor) }, AuthoritySetup = { - |mut service: Self::FullService, executor: TaskExecutor, key: Option>| { + |mut service: Self::FullService, executor: TaskExecutor, local_key: Option>| { let (block_import, link_half) = service.config.custom.grandpa_import_setup.take() .expect("Link Half and Block Import are present for Full Services or setup failed before. qed"); - let local_key = if let Some(key) = key { - if !service.config.custom.grandpa_authority_only { - info!("Using authority key {}", key.public()); - let proposer = Arc::new(substrate_service::ProposerFactory { - client: service.client(), - transaction_pool: service.transaction_pool(), - }); + if let Some(ref key) = local_key { + info!("Using authority key {}", key.public()); + let proposer = Arc::new(substrate_service::ProposerFactory { + client: service.client(), + transaction_pool: service.transaction_pool(), + }); - let client = service.client(); - executor.spawn(start_aura( - SlotDuration::get_or_compute(&*client)?, - key.clone(), - client, - block_import.clone(), - proposer, - service.network(), - )); - } + let client = service.client(); + executor.spawn(start_aura( + SlotDuration::get_or_compute(&*client)?, + key.clone(), + client, + block_import.clone(), + proposer, + service.network(), + )); - if service.config.custom.grandpa_authority { - info!("Running Grandpa session as Authority {}", key.public()); - Some(key) - } else { - None - } - } else { - None - }; + info!("Running Grandpa session as Authority {}", key.public()); + } let voter = grandpa::run_grandpa( grandpa::Config {