(
mut config: Configuration,
)
| 389 | } |
| 390 | |
| 391 | pub fn new_light_base( |
| 392 | mut config: Configuration, |
| 393 | ) -> Result< |
| 394 | ( |
| 395 | TaskManager, |
| 396 | RpcHandlers, |
| 397 | Option<TelemetryConnectionNotifier>, |
| 398 | Arc<LightClient>, |
| 399 | Arc<NetworkService<Block, <Block as BlockT>::Hash>>, |
| 400 | Arc<sc_transaction_pool::LightPool<Block, LightClient, sc_network::config::OnDemand<Block>>>, |
| 401 | ), |
| 402 | ServiceError, |
| 403 | > { |
| 404 | let (client, backend, keystore_container, mut task_manager, on_demand) = |
| 405 | sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?; |
| 406 | |
| 407 | config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config()); |
| 408 | |
| 409 | let select_chain = sc_consensus::LongestChain::new(backend.clone()); |
| 410 | |
| 411 | let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( |
| 412 | config.transaction_pool.clone(), |
| 413 | config.prometheus_registry(), |
| 414 | task_manager.spawn_handle(), |
| 415 | client.clone(), |
| 416 | on_demand.clone(), |
| 417 | )); |
| 418 | |
| 419 | let (grandpa_block_import, _) = |
| 420 | sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain.clone())?; |
| 421 | let justification_import = grandpa_block_import.clone(); |
| 422 | |
| 423 | let (babe_block_import, babe_link) = sc_consensus_babe::block_import( |
| 424 | sc_consensus_babe::Config::get_or_compute(&*client)?, |
| 425 | grandpa_block_import, |
| 426 | client.clone(), |
| 427 | )?; |
| 428 | |
| 429 | let inherent_data_providers = sp_inherents::InherentDataProviders::new(); |
| 430 | |
| 431 | let import_queue = sc_consensus_babe::import_queue( |
| 432 | babe_link, |
| 433 | babe_block_import, |
| 434 | Some(Box::new(justification_import)), |
| 435 | client.clone(), |
| 436 | select_chain.clone(), |
| 437 | inherent_data_providers.clone(), |
| 438 | // TODO - find out why in Substrate 3 they use |
| 439 | // &task_manager.spawn_essential_handle(), but it doesn't work |
| 440 | &task_manager.spawn_handle(), |
| 441 | config.prometheus_registry(), |
| 442 | sp_consensus::NeverCanAuthor, |
| 443 | )?; |
| 444 | |
| 445 | let (network, network_status_sinks, system_rpc_tx, network_starter) = |
| 446 | sc_service::build_network(sc_service::BuildNetworkParams { |
| 447 | config: &config, |
| 448 | client: client.clone(), |
no test coverage detected