mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +00:00
node: add sentry mode flag (#3959)
* node: add sentry mode flag * cli: extend docs on validator and sentry modes * service: add missing field in test Configuration * node: Display instead of Debug when printing node role
This commit is contained in:
committed by
Bastian Köcher
parent
dc14809804
commit
c92eda9809
@@ -31,7 +31,7 @@ pub use cli::{VersionInfo, IntoExit, NoCustom, SharedParams, ExecutionStrategyPa
|
||||
use substrate_service::{AbstractService, Roles as ServiceRoles, Configuration};
|
||||
use log::info;
|
||||
use structopt::{StructOpt, clap::App};
|
||||
use cli::{AugmentClap, GetLogFilter, parse_and_prepare, ParseAndPrepare};
|
||||
use cli::{display_role, parse_and_prepare, AugmentClap, GetLogFilter, ParseAndPrepare};
|
||||
use crate::factory_impl::FactoryState;
|
||||
use transaction_factory::RuntimeAdapter;
|
||||
use client::ExecutionStrategies;
|
||||
@@ -166,7 +166,7 @@ pub fn run<I, T, E>(args: I, exit: E, version: cli::VersionInfo) -> error::Resul
|
||||
info!(" by Parity Technologies, 2017-2019");
|
||||
info!("Chain specification: {}", config.chain_spec.name());
|
||||
info!("Node name: {}", config.name);
|
||||
info!("Roles: {:?}", config.roles);
|
||||
info!("Roles: {}", display_role(&config));
|
||||
let runtime = RuntimeBuilder::new().name_prefix("main-tokio-").build()
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
match config.roles {
|
||||
|
||||
@@ -124,6 +124,11 @@ macro_rules! new_full {
|
||||
$config.disable_grandpa
|
||||
);
|
||||
|
||||
// sentry nodes announce themselves as authorities to the network
|
||||
// and should run the same protocols authorities do, but it should
|
||||
// never actively participate in any consensus process.
|
||||
let participates_in_consensus = is_authority && !$config.sentry_mode;
|
||||
|
||||
let (builder, mut import_setup, inherent_data_providers) = new_full_start!($config);
|
||||
|
||||
// Dht event channel from the network to the authority discovery module. Use bounded channel to ensure
|
||||
@@ -145,7 +150,7 @@ macro_rules! new_full {
|
||||
|
||||
($with_startup_data)(&block_import, &babe_link);
|
||||
|
||||
if is_authority {
|
||||
if participates_in_consensus {
|
||||
let proposer = substrate_basic_authorship::ProposerFactory {
|
||||
client: service.client(),
|
||||
transaction_pool: service.transaction_pool(),
|
||||
@@ -171,13 +176,21 @@ macro_rules! new_full {
|
||||
service.spawn_essential_task(babe);
|
||||
}
|
||||
|
||||
// if the node isn't actively participating in consensus then it doesn't
|
||||
// need a keystore, regardless of which protocol we use below.
|
||||
let keystore = if participates_in_consensus {
|
||||
Some(service.keystore())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let config = grandpa::Config {
|
||||
// FIXME #1578 make this available through chainspec
|
||||
gossip_duration: std::time::Duration::from_millis(333),
|
||||
justification_period: 512,
|
||||
name: Some(name),
|
||||
keystore: Some(service.keystore()),
|
||||
observer_enabled: true,
|
||||
keystore,
|
||||
is_authority,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user