1
- use crate :: consensus:: consensus_mechanism:: SpawnEssentialHandlesParams ;
2
1
use crate :: consensus:: hybrid_import_queue:: HybridBlockImport ;
3
2
use crate :: consensus:: { ConsensusMechanism , StartAuthoringParams } ;
4
3
use crate :: {
@@ -12,6 +11,7 @@ use sc_client_api::{AuxStore, BlockOf, UsageProvider};
12
11
use sc_consensus:: { BlockImport , BoxBlockImport } ;
13
12
use sc_consensus_grandpa:: BlockNumberOps ;
14
13
use sc_consensus_slots:: { BackoffAuthoringBlocksStrategy , InherentDataProviderExt } ;
14
+ use sc_network_sync:: SyncingService ;
15
15
use sc_service:: { Configuration , TaskManager } ;
16
16
use sc_telemetry:: TelemetryHandle ;
17
17
use sc_transaction_pool:: TransactionPoolHandle ;
@@ -193,12 +193,15 @@ impl ConsensusMechanism for AuraConsensus {
193
193
194
194
fn spawn_essential_handles (
195
195
& self ,
196
- p : SpawnEssentialHandlesParams ,
196
+ task_manager : & mut TaskManager ,
197
+ client : Arc < FullClient > ,
198
+ triggered : Option < Arc < std:: sync:: atomic:: AtomicBool > > ,
199
+ sync_service : Arc < SyncingService < Block > > ,
197
200
) -> Result < ( ) , sc_service:: Error > {
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 (
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 (
202
205
"babe-switch" ,
203
206
None ,
204
207
Box :: pin ( async move {
@@ -216,7 +219,7 @@ impl ConsensusMechanism for AuraConsensus {
216
219
// Babe service. If we only wait for the "warp sync" to finish while state
217
220
// sync is still in progress prior to switching, the warp sync will not
218
221
// complete successfully.
219
- let syncing = p . sync_service . status ( ) . await . is_ok_and ( |status| status. warp_sync . is_some ( ) || status. state_sync . is_some ( ) ) ;
222
+ let syncing = sync_service. status ( ) . await . is_ok_and ( |status| status. warp_sync . is_some ( ) || status. state_sync . is_some ( ) ) ;
220
223
if !c. authorities . is_empty ( ) && !syncing {
221
224
log:: info!( "Babe runtime detected! Intentionally failing the essential handle `babe-switch` to trigger switch to Babe service." ) ;
222
225
if let Some ( triggered) = triggered {
0 commit comments