mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +00:00
Move spawning tasks from thread pools to Service's TaskManager for block importing (#5647)
Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ use std::{
|
||||
collections::HashMap
|
||||
};
|
||||
|
||||
use futures::prelude::*;
|
||||
use futures::{prelude::*, future::BoxFuture};
|
||||
use parking_lot::Mutex;
|
||||
use log::{debug, info, trace};
|
||||
|
||||
@@ -788,13 +788,14 @@ impl<Block: BlockT, C, I, P> BlockImport<Block> for AuraBlockImport<Block, C, I,
|
||||
}
|
||||
|
||||
/// Start an import queue for the Aura consensus algorithm.
|
||||
pub fn import_queue<B, I, C, P>(
|
||||
pub fn import_queue<B, I, C, P, F>(
|
||||
slot_duration: SlotDuration,
|
||||
block_import: I,
|
||||
justification_import: Option<BoxJustificationImport<B>>,
|
||||
finality_proof_import: Option<BoxFinalityProofImport<B>>,
|
||||
client: Arc<C>,
|
||||
inherent_data_providers: InherentDataProviders,
|
||||
spawner: F,
|
||||
) -> Result<AuraImportQueue<B, sp_api::TransactionFor<C, B>>, sp_consensus::Error> where
|
||||
B: BlockT,
|
||||
C::Api: BlockBuilderApi<B> + AuraApi<B, AuthorityId<P>> + ApiExt<B, Error = sp_blockchain::Error>,
|
||||
@@ -804,6 +805,7 @@ pub fn import_queue<B, I, C, P>(
|
||||
P: Pair + Send + Sync + 'static,
|
||||
P::Public: Clone + Eq + Send + Sync + Hash + Debug + Encode + Decode,
|
||||
P::Signature: Encode + Decode,
|
||||
F: Fn(BoxFuture<'static, ()>) -> (),
|
||||
{
|
||||
register_aura_inherent_data_provider(&inherent_data_providers, slot_duration.get())?;
|
||||
initialize_authorities_cache(&*client)?;
|
||||
@@ -818,6 +820,7 @@ pub fn import_queue<B, I, C, P>(
|
||||
Box::new(block_import),
|
||||
justification_import,
|
||||
finality_proof_import,
|
||||
spawner,
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user