Small slots refactor (#2780)

* Deprecate SlotWorker::on_start

* start_slot_worker no longer needs an Arc

* start_slot_worker now always succeeds

* Removed on_exit parameter from start_*_worker

* Minor doc

* Fix node-template
This commit is contained in:
Pierre Krieger
2019-06-05 16:31:20 +02:00
committed by DemiMarie-parity
parent eaa0ab014a
commit 67bdfc7d8e
5 changed files with 73 additions and 117 deletions
+4 -3
View File
@@ -14,6 +14,7 @@ use substrate_service::{
};
use basic_authorship::ProposerFactory;
use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration, NothingExtra};
use futures::prelude::*;
use substrate_client::{self as client, LongestChain};
use primitives::{ed25519::Pair, Pair as PairT};
use inherents::InherentDataProviders;
@@ -75,7 +76,7 @@ construct_service_factory! {
let client = service.client();
let select_chain = service.select_chain()
.ok_or_else(|| ServiceError::SelectChainRequired)?;
executor.spawn(start_aura(
let aura = start_aura(
SlotDuration::get_or_compute(&*client)?,
key.clone(),
client.clone(),
@@ -83,10 +84,10 @@ construct_service_factory! {
client,
proposer,
service.network(),
service.on_exit(),
service.config.custom.inherent_data_providers.clone(),
service.config.force_authoring,
)?);
)?;
executor.spawn(aura.select(service.on_exit()).then(|_| Ok(())));
}
Ok(service)