node/service/src/lib: Do not spawn authority discovery on sentries (#1835)

* node/service/src/lib: Do not spawn authority discovery on sentries

The notion of sentry nodes has been deprecated (see [1] for details).
Support for sentry nodes in the `client/authority-discovery` module has
been removed.

This commit adjusts the instantiation of the authority discovery worker
accordingly, only spawning the module on authority nodes.

[1] https://github.com/paritytech/substrate/issues/6845

* "Update Substrate"

Co-authored-by: parity-processbot <>
This commit is contained in:
Max Inden
2020-10-26 11:31:16 +01:00
committed by GitHub
parent 2163988f54
commit 6d7b42b5ac
2 changed files with 151 additions and 164 deletions
+137 -136
View File
File diff suppressed because it is too large Load Diff
+14 -28
View File
@@ -531,41 +531,27 @@ pub fn new_full<RuntimeApi, Executor>(
grandpa::setup_disabled_grandpa(network.clone())?; grandpa::setup_disabled_grandpa(network.clone())?;
} }
if matches!(role, Role::Authority{..} | Role::Sentry{..}) { if role.is_authority() && !authority_discovery_disabled {
use sc_network::Event; use sc_network::Event;
use futures::StreamExt; use futures::StreamExt;
if !authority_discovery_disabled { let authority_discovery_role = authority_discovery::Role::PublishAndDiscover(
let (sentries, authority_discovery_role) = match role { keystore_container.keystore(),
Role::Authority { ref sentry_nodes } => ( );
sentry_nodes.clone(), let dht_event_stream = network.event_stream("authority-discovery")
authority_discovery::Role::Authority ( .filter_map(|e| async move { match e {
keystore_container.keystore(),
),
),
Role::Sentry {..} => (
vec![],
authority_discovery::Role::Sentry,
),
_ => unreachable!("Due to outer matches! constraint; qed."),
};
let network_event_stream = network.event_stream("authority-discovery");
let dht_event_stream = network_event_stream.filter_map(|e| async move { match e {
Event::Dht(e) => Some(e), Event::Dht(e) => Some(e),
_ => None, _ => None,
}}); }});
let (authority_discovery_worker, _service) = authority_discovery::new_worker_and_service( let (authority_discovery_worker, _service) = authority_discovery::new_worker_and_service(
client.clone(), client.clone(),
network.clone(), network.clone(),
sentries, Box::pin(dht_event_stream),
Box::pin(dht_event_stream), authority_discovery_role,
authority_discovery_role, prometheus_registry.clone(),
prometheus_registry.clone(), );
);
task_manager.spawn_handle().spawn("authority-discovery-worker", authority_discovery_worker.run()); task_manager.spawn_handle().spawn("authority-discovery-worker", authority_discovery_worker.run());
}
} }