Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions node-template/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
service.keystore(),
)?;

let select = aura.select(service.on_exit()).then(|_| Ok(()));
let aura = aura.select(service.on_exit()).then(|_| Ok(()));

// the AURA authoring task is considered essential, i.e. if it
// fails we take down the service with it.
service.spawn_essential_task(select);
service.spawn_essential_task(aura);
}

let grandpa_config = grandpa::Config {
Expand All @@ -133,12 +133,12 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
match (is_authority, disable_grandpa) {
(false, false) => {
// start the lightweight GRANDPA observer
service.spawn_task(Box::new(grandpa::run_grandpa_observer(
service.spawn_task(grandpa::run_grandpa_observer(
grandpa_config,
grandpa_link,
service.network(),
service.on_exit(),
)?));
)?);
},
(true, false) => {
// start the full GRANDPA voter
Expand Down
11 changes: 8 additions & 3 deletions node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ macro_rules! new_full_start {
/// concrete types instead.
macro_rules! new_full {
($config:expr, $with_startup_data: expr) => {{
use futures::future::Future;
Comment thread
bkchr marked this conversation as resolved.
Outdated
use futures::sync::mpsc;
use network::DhtEvent;

Expand Down Expand Up @@ -168,13 +169,15 @@ macro_rules! new_full {
};

let babe = babe::start_babe(babe_config)?;
let babe = babe.select(service.on_exit()).then(|_| Ok(()));
Comment thread
bkchr marked this conversation as resolved.
Outdated
service.spawn_essential_task(babe);

let authority_discovery = authority_discovery::AuthorityDiscovery::new(
service.client(),
service.network(),
dht_event_rx,
);

service.spawn_task(authority_discovery);
}

Expand All @@ -189,12 +192,12 @@ macro_rules! new_full {
match (is_authority, disable_grandpa) {
(false, false) => {
// start the lightweight GRANDPA observer
service.spawn_task(Box::new(grandpa::run_grandpa_observer(
service.spawn_task(grandpa::run_grandpa_observer(
config,
grandpa_link,
service.network(),
service.on_exit(),
)?));
)?);
},
(true, false) => {
// start the full GRANDPA voter
Expand All @@ -207,7 +210,9 @@ macro_rules! new_full {
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
voting_rule: grandpa::VotingRulesBuilder::default().build(),
};
service.spawn_task(Box::new(grandpa::run_grandpa_voter(grandpa_config)?));
// the GRANDPA voter task is considered infallible, i.e.
// if it fails we take down the service with it.
service.spawn_essential_task(grandpa::run_grandpa_voter(grandpa_config)?);
},
(_, true) => {
grandpa::setup_disabled_grandpa(
Expand Down