pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceError> {
	let inherent_data_providers = InherentDataProviders::new();

	ServiceBuilder::new_light::<Block, RuntimeApi, Executor>(config)?
		.with_select_chain(|_config, backend| {
			Ok(LongestChain::new(backend.clone()))
		})?
		.with_transaction_pool(|builder| {
			let fetcher = builder.fetcher()
				.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;

			let pool_api = sc_transaction_pool::LightChainApi::new(
				builder.client().clone(),
				fetcher.clone(),
			);
			let pool = sc_transaction_pool::BasicPool::with_revalidation_type(
				builder.config().transaction_pool.clone(),
				Arc::new(pool_api),
				builder.prometheus_registry(),
				sc_transaction_pool::RevalidationType::Light,
			);
			Ok(pool)
		})?
		.with_import_queue_and_fprb(|
			_config,
			client,
			backend,
			fetcher,
			_select_chain,
			_tx_pool,
			spawn_task_handle,
			prometheus_registry,
		| {
			// let fetch_checker = fetcher
			// 	.map(|fetcher| fetcher.checker().clone())
			// 	.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
			// let grandpa_block_import = sc_finality_grandpa::light_block_import(
			// 	client.clone(),
			// 	backend,
			// 	&(client.clone() as Arc<_>),
			// 	Arc::new(fetch_checker),
			// )?;
			// let finality_proof_import = grandpa_block_import.clone();
			// let finality_proof_request_builder =
			// 	finality_proof_import.create_finality_proof_request_builder();

			// let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
			// 	sc_consensus_aura::slot_duration(&*client)?,
			// 	grandpa_block_import,
			// 	None,
			// 	Some(Box::new(finality_proof_import)),
			// 	client,
			// 	inherent_data_providers.clone(),
			// 	spawn_task_handle,
			// 	prometheus_registry,
			// )?;
			let finality_proof_request_builder =
			Box::new(DummyFinalityProofRequestBuilder::default()) as Box<_>;

			let pow_block_import = sc_consensus_pow::PowBlockImport::new(
				client.clone(),
				client.clone(),
				crate::pow::Sha3Algorithm::new(client.clone()),
				0, // check_inherents_after,
				_select_chain,
				inherent_data_providers.clone(),
			);

			let import_queue = sc_consensus_pow::import_queue(
				Box::new(pow_block_import),
				None,
				None,
				crate::pow::Sha3Algorithm::new(client.clone()),
				inherent_data_providers.clone(),
				spawn_task_handle,
				prometheus_registry,
			)?;

			Ok((import_queue, finality_proof_request_builder))
		})?
		.with_finality_proof_provider(|client, backend| {
			// GenesisAuthoritySetProvider is implemented for StorageAndProofProvider
			let provider = client as Arc<dyn StorageAndProofProvider<_, _>>;
			Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _)
		})?
		.build_light()
}
/// 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<impl AbstractService, ServiceError> {
	let inherent_data_providers = InherentDataProviders::new();
	ServiceBuilder::new_light::<Block, RuntimeApi, Executor>(config)?
		.with_select_chain(|_config, backend| {
			Ok(LongestChain::new(backend.clone()))
		})?
		.with_transaction_pool(|builder| {
			let fetcher = builder.fetcher()
				.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
			let pool_api = sc_transaction_pool::LightChainApi::new(
				builder.client().clone(),
				fetcher.clone(),
			);
			let pool = sc_transaction_pool::BasicPool::with_revalidation_type(
				builder.config().transaction_pool.clone(),
				Arc::new(pool_api),
				builder.prometheus_registry(),
				sc_transaction_pool::RevalidationType::Light,
			);
			Ok(pool)
		})?
		.with_import_queue_and_fprb(|
			_config,
			client,
			backend,
			fetcher,
			_select_chain,
			_tx_pool,
			spawn_task_handle,
			prometheus_registry,
		| {
			// let fetch_checker = fetcher
			// 	.map(|fetcher| fetcher.checker().clone())
			// 	.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
			// let grandpa_block_import = sc_finality_grandpa::light_block_import(
			// 	client.clone(),
			// 	backend,
			// 	&(client.clone() as Arc<_>),
			// 	Arc::new(fetch_checker),
			// )?;
			// let finality_proof_import = grandpa_block_import.clone();
			// let finality_proof_request_builder =
			// 	finality_proof_import.create_finality_proof_request_builder();
			// let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
			// 	sc_consensus_aura::slot_duration(&*client)?,
			// 	grandpa_block_import,
			// 	None,
			// 	Some(Box::new(finality_proof_import)),
			// 	client,
			// 	inherent_data_providers.clone(),
			// 	spawn_task_handle,
			// 	prometheus_registry,
			// )?;
			let finality_proof_request_builder =
			Box::new(DummyFinalityProofRequestBuilder::default()) as Box<_>;
			let pow_block_import = sc_consensus_pow::PowBlockImport::new(
				client.clone(),
				client.clone(),
				crate::pow::Sha3Algorithm::new(client.clone()),
				0, // check_inherents_after,
				_select_chain,
				inherent_data_providers.clone(),
			);
			let import_queue = sc_consensus_pow::import_queue(
				Box::new(pow_block_import),
				None,
				None,
				crate::pow::Sha3Algorithm::new(client.clone()),
				inherent_data_providers.clone(),
				spawn_task_handle,
				prometheus_registry,
			)?;
			Ok((import_queue, finality_proof_request_builder))
		})?
		.with_finality_proof_provider(|client, backend| {
			// GenesisAuthoritySetProvider is implemented for StorageAndProofProvider
			let provider = client as Arc<dyn StorageAndProofProvider<_, _>>;
			Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _)
		})?
		.build_light()
}
pub fn new_light ( config : Configuration ) -> Result < impl AbstractService , ServiceError > { let inherent_data_providers = InherentDataProviders :: new ( ) ; ServiceBuilder :: new_light :: < Block , RuntimeApi , Executor > ( config ) ? . with_select_chain ( | _config , backend | { Ok ( LongestChain :: new ( backend . clone ( ) ) ) } ) ? . with_transaction_pool ( | builder | { let fetcher = builder . fetcher ( ) . ok_or_else ( | | " " ) ? ; let pool_api = sc_transaction_pool :: LightChainApi :: new ( builder . client ( ) . clone ( ) , fetcher . clone ( ) , ) ; let pool = sc_transaction_pool :: BasicPool :: with_revalidation_type ( builder . config ( ) . transaction_pool . clone ( ) , Arc :: new ( pool_api ) , builder . prometheus_registry ( ) , sc_transaction_pool :: RevalidationType :: Light , ) ; Ok ( pool ) } ) ? . with_import_queue_and_fprb ( | _config , client , backend , fetcher , _select_chain , _tx_pool , spawn_task_handle , prometheus_registry , | { // let fetch_checker = fetcher // 	.map(|fetcher| fetcher.checker().clone()) // 	.ok_or_else(|| "Trying to start light import queue without active fetch checker")?; // let grandpa_block_import = sc_finality_grandpa::light_block_import( // 	client.clone(), // 	backend, // 	&(client.clone() as Arc<_>), // 	Arc::new(fetch_checker), // )?; // let finality_proof_import = grandpa_block_import.clone(); // let finality_proof_request_builder = // 	finality_proof_import.create_finality_proof_request_builder(); // let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( // 	sc_consensus_aura::slot_duration(&*client)?, // 	grandpa_block_import, // 	None, // 	Some(Box::new(finality_proof_import)), // 	client, // 	inherent_data_providers.clone(), // 	spawn_task_handle, // 	prometheus_registry, // )?; let finality_proof_request_builder = Box :: new ( DummyFinalityProofRequestBuilder :: default ( ) ) as Box < _ > ; let pow_block_import = sc_consensus_pow :: PowBlockImport :: new ( client . clone ( ) , client . clone ( ) , crate :: pow :: Sha3Algorithm :: new ( client . clone ( ) ) , 0 , // check_inherents_after, _select_chain , inherent_data_providers . clone ( ) , ) ; let import_queue = sc_consensus_pow :: import_queue ( Box :: new ( pow_block_import ) , None , None , crate :: pow :: Sha3Algorithm :: new ( client . clone ( ) ) , inherent_data_providers . clone ( ) , spawn_task_handle , prometheus_registry , ) ? ; Ok ( ( import_queue , finality_proof_request_builder ) ) } ) ? . with_finality_proof_provider ( | client , backend | { // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider let provider = client as Arc < dyn StorageAndProofProvider < _ , _ > > ; Ok ( Arc :: new ( GrandpaFinalityProofProvider :: new ( backend , provider ) ) as _ ) } ) ? . build_light ( ) }
Builds a new service for a light client.
Builds a new service for a light client .
config
Configuration
config
Configuration