mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 04:21:06 +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.roles = role;
|
||||||
|
config.disable_grandpa = cli.no_grandpa;
|
||||||
|
|
||||||
let client_id = config.client_id();
|
let client_id = config.client_id();
|
||||||
fill_network_configuration(
|
fill_network_configuration(
|
||||||
cli.network_config,
|
cli.network_config,
|
||||||
|
|||||||
@@ -220,6 +220,10 @@ pub struct RunCmd {
|
|||||||
#[structopt(long = "validator")]
|
#[structopt(long = "validator")]
|
||||||
pub validator: bool,
|
pub validator: bool,
|
||||||
|
|
||||||
|
/// Disable GRANDPA when running in validator mode
|
||||||
|
#[structopt(long = "no-grandpa")]
|
||||||
|
pub no_grandpa: bool,
|
||||||
|
|
||||||
/// Run in light client mode
|
/// Run in light client mode
|
||||||
#[structopt(long = "light")]
|
#[structopt(long = "light")]
|
||||||
pub light: bool,
|
pub light: bool,
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ pub struct Configuration<C, G: Serialize + DeserializeOwned + BuildStorage> {
|
|||||||
pub default_heap_pages: Option<u64>,
|
pub default_heap_pages: Option<u64>,
|
||||||
/// Enable authoring even when offline.
|
/// Enable authoring even when offline.
|
||||||
pub force_authoring: bool,
|
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> {
|
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,
|
telemetry_endpoints: None,
|
||||||
default_heap_pages: None,
|
default_heap_pages: None,
|
||||||
force_authoring: false,
|
force_authoring: false,
|
||||||
|
disable_grandpa: false,
|
||||||
};
|
};
|
||||||
configuration.network.boot_nodes = configuration.chain_spec.boot_nodes().to_vec();
|
configuration.network.boot_nodes = configuration.chain_spec.boot_nodes().to_vec();
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ fn node_config<F: ServiceFactory> (
|
|||||||
telemetry_endpoints: None,
|
telemetry_endpoints: None,
|
||||||
default_heap_pages: None,
|
default_heap_pages: None,
|
||||||
force_authoring: false,
|
force_authoring: false,
|
||||||
|
disable_grandpa: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,12 @@ construct_service_factory! {
|
|||||||
info!("Running Grandpa session as Authority {}", key.public());
|
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(
|
executor.spawn(grandpa::run_grandpa(
|
||||||
grandpa::Config {
|
grandpa::Config {
|
||||||
local_key,
|
local_key,
|
||||||
|
|||||||
Reference in New Issue
Block a user