mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +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:
@@ -72,16 +72,11 @@ macro_rules! new_full_start {
|
||||
pub fn new_full(config: Configuration)
|
||||
-> Result<impl AbstractService, ServiceError>
|
||||
{
|
||||
let is_authority = config.roles.is_authority();
|
||||
let role = config.role.clone();
|
||||
let force_authoring = config.force_authoring;
|
||||
let name = config.name.clone();
|
||||
let disable_grandpa = 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);
|
||||
|
||||
let (block_import, grandpa_link) =
|
||||
@@ -96,11 +91,9 @@ pub fn new_full(config: Configuration)
|
||||
})?
|
||||
.build()?;
|
||||
|
||||
if participates_in_consensus {
|
||||
let proposer = sc_basic_authorship::ProposerFactory::new(
|
||||
service.client(),
|
||||
service.transaction_pool()
|
||||
);
|
||||
if role.is_authority() {
|
||||
let proposer =
|
||||
sc_basic_authorship::ProposerFactory::new(service.client(), service.transaction_pool());
|
||||
|
||||
let client = service.client();
|
||||
let select_chain = service.select_chain()
|
||||
@@ -129,7 +122,7 @@ pub fn new_full(config: Configuration)
|
||||
|
||||
// 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
|
||||
@@ -142,7 +135,7 @@ pub fn new_full(config: Configuration)
|
||||
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