@@ -17,6 +17,7 @@ use crate::{
17
17
schema:: build_schema,
18
18
service:: {
19
19
adapters:: {
20
+ block_production_trigger:: BlockProductionTrigger ,
20
21
consensus_module:: poa:: InDirectoryPredefinedBlocks ,
21
22
consensus_parameters_provider,
22
23
fuel_gas_price_provider:: FuelGasPriceProvider ,
@@ -66,6 +67,7 @@ pub type PoAService = fuel_core_poa::Service<
66
67
SignMode ,
67
68
InDirectoryPredefinedBlocks ,
68
69
SystemTime ,
70
+ BlockProductionTrigger ,
69
71
> ;
70
72
#[ cfg( feature = "p2p" ) ]
71
73
pub type P2PService = fuel_core_p2p:: service:: Service < Database , TxPoolAdapter > ;
@@ -86,6 +88,7 @@ pub const DEFAULT_GAS_PRICE_CHANGE_PERCENT: u16 = 10;
86
88
pub fn init_sub_services (
87
89
config : & Config ,
88
90
database : CombinedDatabase ,
91
+ block_production_trigger : BlockProductionTrigger ,
89
92
) -> anyhow:: Result < ( SubServices , SharedState ) > {
90
93
let chain_config = config. snapshot_reader . chain_config ( ) ;
91
94
let chain_id = chain_config. consensus_parameters . chain_id ( ) ;
@@ -158,6 +161,8 @@ pub fn init_sub_services(
158
161
#[ cfg( feature = "relayer" ) ]
159
162
relayer_synced : relayer_service. as_ref ( ) . map ( |r| r. shared . clone ( ) ) ,
160
163
#[ cfg( feature = "relayer" ) ]
164
+ relayer_database : database. relayer ( ) . clone ( ) ,
165
+ #[ cfg( feature = "relayer" ) ]
161
166
da_deploy_height : config. relayer . as_ref ( ) . map_or (
162
167
DaBlockHeight ( RelayerConfig :: DEFAULT_DA_DEPLOY_HEIGHT ) ,
163
168
|config| config. da_deploy_height ,
@@ -295,6 +300,7 @@ pub fn init_sub_services(
295
300
signer,
296
301
predefined_blocks,
297
302
SystemTime ,
303
+ block_production_trigger,
298
304
)
299
305
} ) ;
300
306
let poa_adapter = PoAAdapter :: new ( poa. as_ref ( ) . map ( |service| service. shared . clone ( ) ) ) ;
@@ -376,10 +382,6 @@ pub fn init_sub_services(
376
382
Box :: new( consensus_parameters_provider_service) ,
377
383
] ;
378
384
379
- if let Some ( poa) = poa {
380
- services. push ( Box :: new ( poa) ) ;
381
- }
382
-
383
385
#[ cfg( feature = "relayer" ) ]
384
386
if let Some ( relayer) = relayer_service {
385
387
services. push ( Box :: new ( relayer) ) ;
@@ -398,5 +400,10 @@ pub fn init_sub_services(
398
400
services. push ( Box :: new ( graph_ql) ) ;
399
401
services. push ( Box :: new ( graphql_worker) ) ;
400
402
403
+ // always make sure that the block producer is inserted last
404
+ if let Some ( poa) = poa {
405
+ services. push ( Box :: new ( poa) ) ;
406
+ }
407
+
401
408
Ok ( ( services, shared) )
402
409
}
0 commit comments