/// Builds a new service for a light client.
Builds a new service for a light client.
Builds a new service for a light client .
pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
	let (client, backend, keystore_container, mut task_manager, on_demand) =
		sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
	let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
		config.transaction_pool.clone(),
		config.prometheus_registry(),
		task_manager.spawn_handle(),
		client.clone(),
		on_demand.clone(),
	));
	let select_chain = sc_consensus::LongestChain::new(backend.clone());
	let inherent_data_providers = build_inherent_data_providers()?;
	// FixMe #375
	let _can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
	let pow_block_import = sc_consensus_pow::PowBlockImport::new(
		client.clone(),
		client.clone(),
		sha3pow::MinimalSha3Algorithm,
		0, // check inherents starting at block 0
		select_chain,
		inherent_data_providers.clone(),
		// FixMe #375
		sp_consensus::AlwaysCanAuthor,
	);
	let import_queue = sc_consensus_pow::import_queue(
		Box::new(pow_block_import),
		None,
		sha3pow::MinimalSha3Algorithm,
		inherent_data_providers,
		&task_manager.spawn_handle(),
		config.prometheus_registry(),
	)?;
	let (network, network_status_sinks, system_rpc_tx, network_starter) =
		sc_service::build_network(sc_service::BuildNetworkParams {
			config: &config,
			client: client.clone(),
			transaction_pool: transaction_pool.clone(),
			spawn_handle: task_manager.spawn_handle(),
			import_queue,
			on_demand: Some(on_demand.clone()),
			warp_sync,
			block_announce_validator_builder: None,
		})?;
	sc_service::spawn_tasks(sc_service::SpawnTasksParams {
		remote_blockchain: Some(backend.remote_blockchain()),
		transaction_pool,
		task_manager: &mut task_manager,
		on_demand: Some(on_demand),
		rpc_extensions_builder: Box::new(|_, _| ()),
		config,
		client,
		keystore: keystore_container.sync_keystore(),
		backend,
		network,
		telemetry,
		system_rpc_tx,
	})?;
	network_starter.start_network();
	Ok(task_manager)
}
pub fn new_light ( config : Configuration ) -> Result < TaskManager , ServiceError > { let ( client , backend , keystore_container , mut task_manager , on_demand ) = sc_service :: new_light_parts :: < Block , RuntimeApi , Executor > ( & config ) ? ; let transaction_pool = Arc :: new ( sc_transaction_pool :: BasicPool :: new_light ( config . transaction_pool . clone ( ) , config . prometheus_registry ( ) , task_manager . spawn_handle ( ) , client . clone ( ) , on_demand . clone ( ) , ) ) ; let select_chain = sc_consensus :: LongestChain :: new ( backend . clone ( ) ) ; let inherent_data_providers = build_inherent_data_providers ( ) ? ; // FixMe #375 let _can_author_with = sp_consensus :: CanAuthorWithNativeVersion :: new ( client . executor ( ) . clone ( ) ) ; let pow_block_import = sc_consensus_pow :: PowBlockImport :: new ( client . clone ( ) , client . clone ( ) , sha3pow :: MinimalSha3Algorithm , 0 , // check inherents starting at block 0 select_chain , inherent_data_providers . clone ( ) , // FixMe #375 sp_consensus :: AlwaysCanAuthor , ) ; let import_queue = sc_consensus_pow :: import_queue ( Box :: new ( pow_block_import ) , None , sha3pow :: MinimalSha3Algorithm , inherent_data_providers , & task_manager . spawn_handle ( ) , config . prometheus_registry ( ) , ) ? ; let ( network , network_status_sinks , system_rpc_tx , network_starter ) = sc_service :: build_network ( sc_service :: BuildNetworkParams { config : & config , client : client . clone ( ) , transaction_pool : transaction_pool . clone ( ) , spawn_handle : task_manager . spawn_handle ( ) , import_queue , on_demand : Some ( on_demand . clone ( ) ) , warp_sync , block_announce_validator_builder : None , } ) ? ; sc_service :: spawn_tasks ( sc_service :: SpawnTasksParams { remote_blockchain : Some ( backend . remote_blockchain ( ) ) , transaction_pool , task_manager : & mut task_manager , on_demand : Some ( on_demand ) , rpc_extensions_builder : Box :: new ( | _ , _ | ( ) ) , config , client , keystore : keystore_container . sync_keystore ( ) , backend , network , telemetry , system_rpc_tx , } ) ? ; network_starter . start_network ( ) ; Ok ( task_manager ) }
Builds a new service for a light client.
Builds a new service for a light client .
config
Configuration