@@ -30,7 +30,7 @@ use sc_consensus_babe::BabeWorkerHandle;
3030use sc_consensus_grandpa:: SharedVoterState ;
3131#[ allow( deprecated) ]
3232pub use sc_executor:: WasmExecutor ;
33- use sc_service:: { Configuration , TaskManager , error:: Error as ServiceError } ;
33+ use sc_service:: { ChainType , Configuration , TaskManager , error:: Error as ServiceError } ;
3434use sc_telemetry:: { Telemetry , TelemetryHandle , TelemetryWorker } ;
3535use sc_transaction_pool_api:: OffchainTransactionPoolFactory ;
3636use sp_core:: U256 ;
9898 GrandpaBlockImport ,
9999 ) -> Result < ( BasicQueue < Block > , BoxBlockImport ) , ServiceError > ,
100100{
101- println ! ( " ++++++++++++++++++++++++
102- +++++++++++++++++++++++++++
103- +++++++++++++++++++++++++++
101+ println ! ( " ++++++++++++++++++++++++
102+ +++++++++++++++++++++++++++
103+ +++++++++++++++++++++++++++
104104 +++ ++++++ +++ @%%%%%%%%%%% %%%
105105 ++++++ ++++ +++++ %%%%%%%%%%%% %%%@
106106 ++++++++++++++++++++++++++ %%%% %%%%@ %%% %%@ @%%%%%%% %%%@ %%%%@
@@ -109,8 +109,8 @@ where
109109 ++++++++++++++++++++++++++ %%%% %%%%%%%%% %%% %%%% %%% @%%% %%%@ @%%%%% %%%%%
110110 ++++++ ++++ ++++++ %%%% %%%%%%%%% %%% %%%% %%%%%%%%%% %%%@ %%%%%%%%%@
111111 +++ ++++++ +++ %%%% %%%%%%%%% %%% %%%@ %%%%%%%%% %%% %%%%%%%@
112- ++++ +++++++++ +++ %%%% %%%%
113- ++++++++++++++++++++++++++++ %%%%%%%%%
112+ ++++ +++++++++ +++ %%%% %%%%
113+ ++++++++++++++++++++++++++++ %%%%%%%%%
114114 +++++++++++++++++++++++ %%%%% \n " ) ;
115115
116116 let telemetry = config
@@ -337,6 +337,23 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
337337 metrics,
338338 } ) ?;
339339
340+ if config. role . is_authority ( ) {
341+ if config. chain_spec . chain_type ( ) == ChainType :: Development
342+ || config. chain_spec . chain_type ( ) == ChainType :: Local
343+ {
344+ if auto_insert_keys {
345+ crate :: utils:: insert_controller_account_keys_into_keystore (
346+ & config,
347+ Some ( keystore_container. local_keystore ( ) ) ,
348+ ) ;
349+ } else {
350+ crate :: utils:: insert_dev_controller_account_keys_into_keystore (
351+ & config,
352+ Some ( keystore_container. local_keystore ( ) ) ,
353+ ) ;
354+ }
355+ }
356+ }
340357 let role = config. role . clone ( ) ;
341358 let force_authoring = config. force_authoring ;
342359 let name = config. network . node_name . clone ( ) ;
@@ -506,6 +523,10 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
506523 )
507524 . await ;
508525
526+ #[ cfg( feature = "blueprint-manager" ) ]
527+ let config_data_path = config. data_path . clone ( ) ;
528+ #[ cfg( feature = "blueprint-manager" ) ]
529+ let rpc_port = config. rpc_port ;
509530 let params = sc_service:: SpawnTasksParams {
510531 network : network. clone ( ) ,
511532 client : client. clone ( ) ,
@@ -600,6 +621,27 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
600621
601622 network_starter. start_network ( ) ;
602623 log:: info!( "Manual Seal Ready" ) ;
624+
625+ #[ cfg( feature = "blueprint-manager" ) ]
626+ {
627+ log:: info!( "Blueprint Manager is enabled." ) ;
628+ let bp_mngr = crate :: blueprint_service:: create_blueprint_manager_service (
629+ rpc_port,
630+ config_data_path. join ( "blueprints" ) ,
631+ keystore_container. local_keystore ( ) ,
632+ ) ?;
633+
634+ task_manager
635+ . spawn_essential_handle ( )
636+ . spawn ( "blueprint-manager" , None , async move {
637+ match bp_mngr. await {
638+ Ok ( ( ) ) => ( ) ,
639+ Err ( e) => {
640+ log:: error!( "Blueprint manager failed: {}" , e) ;
641+ } ,
642+ }
643+ } ) ;
644+ }
603645 return Ok ( task_manager) ;
604646 }
605647
@@ -644,6 +686,27 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
644686 ) ;
645687 }
646688
689+ #[ cfg( feature = "blueprint-manager" ) ]
690+ {
691+ log:: info!( "Blueprint Manager is enabled." ) ;
692+ let bp_mngr = crate :: blueprint_service:: create_blueprint_manager_service (
693+ rpc_port,
694+ config_data_path. join ( "blueprints" ) ,
695+ keystore_container. local_keystore ( ) ,
696+ ) ?;
697+
698+ task_manager
699+ . spawn_essential_handle ( )
700+ . spawn ( "blueprint-manager" , None , async move {
701+ match bp_mngr. await {
702+ Ok ( ( ) ) => ( ) ,
703+ Err ( e) => {
704+ log:: error!( "Blueprint manager failed: {}" , e) ;
705+ } ,
706+ }
707+ } ) ;
708+ }
709+
647710 network_starter. start_network ( ) ;
648711 Ok ( task_manager)
649712}
0 commit comments