mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 19:38:02 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ fn node_config<F: ServiceFactory> (
|
||||
telemetry_endpoints: None,
|
||||
default_heap_pages: None,
|
||||
force_authoring: false,
|
||||
disable_grandpa: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user