pub fn new_light_parts<TBl, TRtApi, TExecDisp>(
	config: &Configuration
) -> Result<TLightParts<TBl, TRtApi, TExecDisp>, Error> where
	TBl: BlockT,
	TExecDisp: NativeExecutionDispatch + 'static,
{
	let keystore_container = KeystoreContainer::new(&config.keystore)?;
	let task_manager = {
		let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
		TaskManager::new(config.task_executor.clone(), registry)?
	};

	let executor = NativeExecutor::<TExecDisp>::new(
		config.wasm_method,
		config.default_heap_pages,
		config.max_runtime_instances,
	);

	let db_storage = {
		let db_settings = sc_client_db::DatabaseSettings {
			state_cache_size: config.state_cache_size,
			state_cache_child_ratio:
				config.state_cache_child_ratio.map(|v| (v, 100)),
			pruning: config.pruning.clone(),
			source: config.database.clone(),
		};
		sc_client_db::light::LightStorage::new(db_settings)?
	};
	let light_blockchain = sc_light::new_light_blockchain(db_storage);
	let fetch_checker = Arc::new(
		sc_light::new_fetch_checker::<_, TBl, _>(
			light_blockchain.clone(),
			executor.clone(),
			Box::new(task_manager.spawn_handle()),
		),
	);
	let on_demand = Arc::new(sc_network::config::OnDemand::new(fetch_checker));
	let backend = sc_light::new_light_backend(light_blockchain);
	let client = Arc::new(light::new_light(
		backend.clone(),
		config.chain_spec.as_storage_builder(),
		executor,
		Box::new(task_manager.spawn_handle()),
		config.prometheus_config.as_ref().map(|config| config.registry.clone()),
	)?);

	Ok((client, backend, keystore_container, task_manager, on_demand))
}
/// Create the initial parts of a light node.
Create the initial parts of a light node.
Create the initial parts of a light node .
pub fn new_light_parts<TBl, TRtApi, TExecDisp>(
	config: &Configuration
) -> Result<TLightParts<TBl, TRtApi, TExecDisp>, Error> where
	TBl: BlockT,
	TExecDisp: NativeExecutionDispatch + 'static,
{
	let keystore_container = KeystoreContainer::new(&config.keystore)?;
	let task_manager = {
		let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
		TaskManager::new(config.task_executor.clone(), registry)?
	};
	let executor = NativeExecutor::<TExecDisp>::new(
		config.wasm_method,
		config.default_heap_pages,
		config.max_runtime_instances,
	);
	let db_storage = {
		let db_settings = sc_client_db::DatabaseSettings {
			state_cache_size: config.state_cache_size,
			state_cache_child_ratio:
				config.state_cache_child_ratio.map(|v| (v, 100)),
			pruning: config.pruning.clone(),
			source: config.database.clone(),
		};
		sc_client_db::light::LightStorage::new(db_settings)?
	};
	let light_blockchain = sc_light::new_light_blockchain(db_storage);
	let fetch_checker = Arc::new(
		sc_light::new_fetch_checker::<_, TBl, _>(
			light_blockchain.clone(),
			executor.clone(),
			Box::new(task_manager.spawn_handle()),
		),
	);
	let on_demand = Arc::new(sc_network::config::OnDemand::new(fetch_checker));
	let backend = sc_light::new_light_backend(light_blockchain);
	let client = Arc::new(light::new_light(
		backend.clone(),
		config.chain_spec.as_storage_builder(),
		executor,
		Box::new(task_manager.spawn_handle()),
		config.prometheus_config.as_ref().map(|config| config.registry.clone()),
	)?);
	Ok((client, backend, keystore_container, task_manager, on_demand))
}
pub fn new_light_parts < TBl , TRtApi , TExecDisp > ( config : & Configuration ) -> Result < TLightParts < TBl , TRtApi , TExecDisp > , Error > where TBl : BlockT , TExecDisp : NativeExecutionDispatch + ' static , { let keystore_container = KeystoreContainer :: new ( & config . keystore ) ? ; let task_manager = { let registry = config . prometheus_config . as_ref ( ) . map ( | cfg | & cfg . registry ) ; TaskManager :: new ( config . task_executor . clone ( ) , registry ) ? } ; let executor = NativeExecutor :: < TExecDisp > :: new ( config . wasm_method , config . default_heap_pages , config . max_runtime_instances , ) ; let db_storage = { let db_settings = sc_client_db :: DatabaseSettings { state_cache_size : config . state_cache_size , state_cache_child_ratio : config . state_cache_child_ratio . map ( | v | ( v , 100 ) ) , pruning : config . pruning . clone ( ) , source : config . database . clone ( ) , } ; sc_client_db :: light :: LightStorage :: new ( db_settings ) ? } ; let light_blockchain = sc_light :: new_light_blockchain ( db_storage ) ; let fetch_checker = Arc :: new ( sc_light :: new_fetch_checker :: < _ , TBl , _ > ( light_blockchain . clone ( ) , executor . clone ( ) , Box :: new ( task_manager . spawn_handle ( ) ) , ) , ) ; let on_demand = Arc :: new ( sc_network :: config :: OnDemand :: new ( fetch_checker ) ) ; let backend = sc_light :: new_light_backend ( light_blockchain ) ; let client = Arc :: new ( light :: new_light ( backend . clone ( ) , config . chain_spec . as_storage_builder ( ) , executor , Box :: new ( task_manager . spawn_handle ( ) ) , config . prometheus_config . as_ref ( ) . map ( | config | config . registry . clone ( ) ) , ) ? ) ; Ok ( ( client , backend , keystore_container , task_manager , on_demand ) ) }
Create the initial parts of a light node.
Create the initial parts of a light node .
config
&Configuration
config
&Configuration