mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Split the Roles in three types (#5520)
* Split the Roles bitfield in three * Forgot to include some changes * Fix cli test * More test fixes * Oh God, merging master broke other tests * Didn't run the doctests * Address review * I'm trying to fix the build blindly because it's taking a good hour to compile on my machine * Address some review * Also update the peerset's API to make sense * Fix peerset tests * Fix browser node * client: distinguish between local and network authority Co-authored-by: André Silva <andre.beat@gmail.com>
This commit is contained in:
@@ -120,24 +120,17 @@ macro_rules! new_full {
|
||||
use sc_client_api::ExecutorProvider;
|
||||
|
||||
let (
|
||||
is_authority,
|
||||
role,
|
||||
force_authoring,
|
||||
name,
|
||||
disable_grandpa,
|
||||
sentry_nodes,
|
||||
) = (
|
||||
$config.roles.is_authority(),
|
||||
$config.role.clone(),
|
||||
$config.force_authoring,
|
||||
$config.name.clone(),
|
||||
$config.disable_grandpa,
|
||||
$config.network.sentry_nodes.clone(),
|
||||
);
|
||||
|
||||
// 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);
|
||||
|
||||
let service = builder
|
||||
@@ -153,7 +146,7 @@ macro_rules! new_full {
|
||||
|
||||
($with_startup_data)(&block_import, &babe_link);
|
||||
|
||||
if participates_in_consensus {
|
||||
if let sc_service::config::Role::Authority { sentry_nodes } = &role {
|
||||
let proposer = sc_basic_authorship::ProposerFactory::new(
|
||||
service.client(),
|
||||
service.transaction_pool()
|
||||
@@ -190,7 +183,7 @@ macro_rules! new_full {
|
||||
let authority_discovery = sc_authority_discovery::AuthorityDiscovery::new(
|
||||
service.client(),
|
||||
network,
|
||||
sentry_nodes,
|
||||
sentry_nodes.clone(),
|
||||
service.keystore(),
|
||||
dht_event_stream,
|
||||
service.prometheus_registry(),
|
||||
@@ -201,7 +194,7 @@ macro_rules! new_full {
|
||||
|
||||
// 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 {
|
||||
let keystore = if role.is_authority() {
|
||||
Some(service.keystore())
|
||||
} else {
|
||||
None
|
||||
@@ -214,7 +207,7 @@ macro_rules! new_full {
|
||||
name: Some(name),
|
||||
observer_enabled: false,
|
||||
keystore,
|
||||
is_authority,
|
||||
is_authority: role.is_network_authority(),
|
||||
};
|
||||
|
||||
let enable_grandpa = !disable_grandpa;
|
||||
|
||||
Reference in New Issue
Block a user