diff --git a/substrate/core/cli/src/lib.rs b/substrate/core/cli/src/lib.rs index dd47fb73bd..1d335c9b64 100644 --- a/substrate/core/cli/src/lib.rs +++ b/substrate/core/cli/src/lib.rs @@ -427,6 +427,8 @@ where }; config.roles = role; + config.disable_grandpa = cli.no_grandpa; + let client_id = config.client_id(); fill_network_configuration( cli.network_config, diff --git a/substrate/core/cli/src/params.rs b/substrate/core/cli/src/params.rs index 21ceafa20f..7b9b224da9 100644 --- a/substrate/core/cli/src/params.rs +++ b/substrate/core/cli/src/params.rs @@ -220,6 +220,10 @@ pub struct RunCmd { #[structopt(long = "validator")] pub validator: bool, + /// Disable GRANDPA when running in validator mode + #[structopt(long = "no-grandpa")] + pub no_grandpa: bool, + /// Run in light client mode #[structopt(long = "light")] pub light: bool, diff --git a/substrate/core/service/src/config.rs b/substrate/core/service/src/config.rs index e7503d0ad2..7bafa4c83e 100644 --- a/substrate/core/service/src/config.rs +++ b/substrate/core/service/src/config.rs @@ -70,6 +70,8 @@ pub struct Configuration { pub default_heap_pages: Option, /// Enable authoring even when offline. pub force_authoring: bool, + /// Disable GRANDPA when running in validator mode + pub disable_grandpa: bool, } impl Configuration { @@ -96,6 +98,7 @@ impl Configuration ( telemetry_endpoints: None, default_heap_pages: None, force_authoring: false, + disable_grandpa: false, } } diff --git a/substrate/node/cli/src/service.rs b/substrate/node/cli/src/service.rs index b65dbc7444..37de34e402 100644 --- a/substrate/node/cli/src/service.rs +++ b/substrate/node/cli/src/service.rs @@ -103,6 +103,12 @@ construct_service_factory! { info!("Running Grandpa session as Authority {}", key.public()); } + let local_key = if service.config.disable_grandpa { + None + } else { + local_key + }; + executor.spawn(grandpa::run_grandpa( grandpa::Config { local_key,