1+ use crate :: consensus:: consensus_mechanism:: SpawnEssentialHandlesParams ;
12use crate :: consensus:: hybrid_import_queue:: HybridBlockImport ;
23use crate :: consensus:: { ConsensusMechanism , StartAuthoringParams } ;
34use crate :: {
@@ -11,7 +12,6 @@ use sc_client_api::{AuxStore, BlockOf, UsageProvider};
1112use sc_consensus:: { BlockImport , BoxBlockImport } ;
1213use sc_consensus_grandpa:: BlockNumberOps ;
1314use sc_consensus_slots:: { BackoffAuthoringBlocksStrategy , InherentDataProviderExt } ;
14- use sc_network_sync:: SyncingService ;
1515use sc_service:: { Configuration , TaskManager } ;
1616use sc_telemetry:: TelemetryHandle ;
1717use sc_transaction_pool:: TransactionPoolHandle ;
@@ -193,15 +193,12 @@ impl ConsensusMechanism for AuraConsensus {
193193
194194 fn spawn_essential_handles (
195195 & self ,
196- task_manager : & mut TaskManager ,
197- client : Arc < FullClient > ,
198- triggered : Option < Arc < std:: sync:: atomic:: AtomicBool > > ,
199- sync_service : Arc < SyncingService < Block > > ,
196+ p : SpawnEssentialHandlesParams ,
200197 ) -> Result < ( ) , sc_service:: Error > {
201- let client_clone = client. clone ( ) ;
202- let triggered_clone = triggered. clone ( ) ;
203- let slot_duration = self . slot_duration ( & client) ?;
204- task_manager. spawn_essential_handle ( ) . spawn (
198+ let client_clone = p . client . clone ( ) ;
199+ let triggered_clone = p . triggered . clone ( ) ;
200+ let slot_duration = self . slot_duration ( & p . client ) ?;
201+ p . task_manager . spawn_essential_handle ( ) . spawn (
205202 "babe-switch" ,
206203 None ,
207204 Box :: pin ( async move {
@@ -219,7 +216,7 @@ impl ConsensusMechanism for AuraConsensus {
219216 // Babe service. If we only wait for the "warp sync" to finish while state
220217 // sync is still in progress prior to switching, the warp sync will not
221218 // complete successfully.
222- let syncing = sync_service. status ( ) . await . is_ok_and ( |status| status. warp_sync . is_some ( ) || status. state_sync . is_some ( ) ) ;
219+ let syncing = p . sync_service . status ( ) . await . is_ok_and ( |status| status. warp_sync . is_some ( ) || status. state_sync . is_some ( ) ) ;
223220 if !c. authorities . is_empty ( ) && !syncing {
224221 log:: info!( "Babe runtime detected! Intentionally failing the essential handle `babe-switch` to trigger switch to Babe service." ) ;
225222 if let Some ( triggered) = triggered {
0 commit comments