node: fix shutdown (#1308)

* node: remove grandpa authority flags

* node: exit-guard grandpa and aura spawned futures

* node: wait for futures to stop running on shutdown

* core: run connectivity tests on same ports

* core: pass on_exit future when starting aura and grandpa

* node: add issue number to todo

* core: fix aura and grandpa tests
This commit is contained in:
André Silva
2018-12-21 16:30:45 +00:00
committed by Robert Habermeier
parent ef8b94656e
commit f8f932d123
7 changed files with 54 additions and 28 deletions
+13 -12
View File
@@ -19,19 +19,20 @@
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
use std::sync::Arc;
use transaction_pool::{self, txpool::{Pool as TransactionPool}};
use node_runtime::{GenesisConfig, RuntimeApi};
use std::time::Duration;
use client;
use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra};
use grandpa;
use node_executor;
use primitives::ed25519::Pair;
use node_primitives::{Block, InherentData};
use node_runtime::{GenesisConfig, RuntimeApi};
use substrate_service::{
FactoryFullConfiguration, LightComponents, FullComponents, FullBackend,
FullClient, LightClient, LightBackend, FullExecutor, LightExecutor, TaskExecutor
};
use node_executor;
use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra};
use primitives::ed25519::Pair;
use client;
use std::time::Duration;
use grandpa;
use transaction_pool::{self, txpool::{Pool as TransactionPool}};
construct_simple_protocol! {
/// Demo protocol attachment for substrate.
@@ -89,12 +90,13 @@ construct_service_factory! {
block_import.clone(),
proposer,
service.network(),
service.on_exit(),
));
info!("Running Grandpa session as Authority {}", key.public());
}
let voter = grandpa::run_grandpa(
executor.spawn(grandpa::run_grandpa(
grandpa::Config {
local_key,
gossip_duration: Duration::new(4, 0), // FIXME: make this available through chainspec?
@@ -102,9 +104,8 @@ construct_service_factory! {
},
link_half,
grandpa::NetworkBridge::new(service.network()),
)?;
executor.spawn(voter);
service.on_exit(),
)?);
Ok(service)
}