core: cli flag to disable grandpa (#2105)

* core: cli flag to disable grandpa

* core: fix test service configuration

* Update core/service/test/src/lib.rs
This commit is contained in:
André Silva
2019-03-25 15:19:36 +00:00
committed by GitHub
parent 620e8dc8b9
commit e28ff32b89
5 changed files with 16 additions and 0 deletions
+2
View File
@@ -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,
+4
View File
@@ -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,
+3
View File
@@ -70,6 +70,8 @@ pub struct Configuration<C, G: Serialize + DeserializeOwned + BuildStorage> {
pub default_heap_pages: Option<u64>,
/// Enable authoring even when offline.
pub force_authoring: bool,
/// Disable GRANDPA when running in validator mode
pub disable_grandpa: bool,
}
impl<C: Default, G: Serialize + DeserializeOwned + BuildStorage> Configuration<C, G> {
@@ -96,6 +98,7 @@ impl<C: Default, G: Serialize + DeserializeOwned + BuildStorage> Configuration<C
telemetry_endpoints: None,
default_heap_pages: None,
force_authoring: false,
disable_grandpa: false,
};
configuration.network.boot_nodes = configuration.chain_spec.boot_nodes().to_vec();
+1
View File
@@ -121,6 +121,7 @@ fn node_config<F: ServiceFactory> (
telemetry_endpoints: None,
default_heap_pages: None,
force_authoring: false,
disable_grandpa: false,
}
}
+6
View File
@@ -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,