Unverified Commit fb30dc20 authored by Max Inden's avatar Max Inden Committed by GitHub
Browse files

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 <>
parent f74668b6
Pipeline #111837 failed with stages
in 14 minutes and 28 seconds
This diff is collapsed.
......@@ -531,41 +531,27 @@ pub fn new_full<RuntimeApi, Executor>(
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 futures::StreamExt;
if !authority_discovery_disabled {
let (sentries, authority_discovery_role) = match role {
Role::Authority { ref sentry_nodes } => (
sentry_nodes.clone(),
authority_discovery::Role::Authority (
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 {
let authority_discovery_role = authority_discovery::Role::PublishAndDiscover(
keystore_container.keystore(),
);
let dht_event_stream = network.event_stream("authority-discovery")
.filter_map(|e| async move { match e {
Event::Dht(e) => Some(e),
_ => None,
}});
let (authority_discovery_worker, _service) = authority_discovery::new_worker_and_service(
client.clone(),
network.clone(),
sentries,
Box::pin(dht_event_stream),
authority_discovery_role,
prometheus_registry.clone(),
);
task_manager.spawn_handle().spawn("authority-discovery-worker", authority_discovery_worker.run());
}
let (authority_discovery_worker, _service) = authority_discovery::new_worker_and_service(
client.clone(),
network.clone(),
Box::pin(dht_event_stream),
authority_discovery_role,
prometheus_registry.clone(),
);
task_manager.spawn_handle().spawn("authority-discovery-worker", authority_discovery_worker.run());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment