pub fn on_block_imported<A>(
		&self,
		number: &<Block::Header as traits::Header>::Number,
		pool: &Arc<Pool<A>>,
	) where
		A: ChainApi<Block=Block> + 'static,
	{
		let runtime = self.client.runtime_api();
		let at = BlockId::number(*number);
		let has_api = runtime.has_api::<OffchainWorkerApi<Block>>(&at);
		debug!("Checking offchain workers at {:?}: {:?}", at, has_api);

		if has_api.unwrap_or(false) {
			let (api, runner) = api::Api::new(pool.clone(), self.inherents_pool.clone(), at.clone());
			self.executor.spawn(runner.process());

			debug!("Running offchain workers at {:?}", at);
			let api = Box::new(api);
			runtime.offchain_worker_with_context(&at, ExecutionContext::OffchainWorker(api), *number).unwrap();
		}
	}
/// Start the offchain workers after given block.
Start the offchain workers after given block.
Start the offchain workers after given block .
pub fn on_block_imported<A>(
		&self,
		number: &<Block::Header as traits::Header>::Number,
		pool: &Arc<Pool<A>>,
	) where
		A: ChainApi<Block=Block> + 'static,
	{
		let runtime = self.client.runtime_api();
		let at = BlockId::number(*number);
		let has_api = runtime.has_api::<OffchainWorkerApi<Block>>(&at);
		debug!("Checking offchain workers at {:?}: {:?}", at, has_api);
		if has_api.unwrap_or(false) {
			let (api, runner) = api::Api::new(pool.clone(), self.inherents_pool.clone(), at.clone());
			self.executor.spawn(runner.process());
			debug!("Running offchain workers at {:?}", at);
			let api = Box::new(api);
			runtime.offchain_worker_with_context(&at, ExecutionContext::OffchainWorker(api), *number).unwrap();
		}
	}
pub fn on_block_imported < A > ( & self , number : & < Block :: Header as traits :: Header > :: Number , pool : & Arc < Pool < A > > , ) where A : ChainApi < Block = Block > + ' static , { let runtime = self . client . runtime_api ( ) ; let at = BlockId :: number ( * number ) ; let has_api = runtime . has_api :: < OffchainWorkerApi < Block > > ( & at ) ; debug ! ( " " at has_api ) ; if has_api . unwrap_or ( false ) { let ( api , runner ) = api :: Api :: new ( pool . clone ( ) , self . inherents_pool . clone ( ) , at . clone ( ) ) ; self . executor . spawn ( runner . process ( ) ) ; debug ! ( " " at ) ; let api = Box :: new ( api ) ; runtime . offchain_worker_with_context ( & at , ExecutionContext :: OffchainWorker ( api ) , * number ) . unwrap ( ) ; } }
Start the offchain workers after given block.
Start the offchain workers after given block .
&self
number
&<Block::Header as traits::Header>::Number
pool
&Arc<Pool<A>>
&self
number
&<Block::Header as traits::Header>::Number
pool
&Arc<Pool<A>>