fn offchain_worker(block_number: T::BlockNumber) {
			// Note that having logs compiled to WASM may cause the size of the blob to increase
			// significantly. You can use `RuntimeDebug` custom derive to hide details of the types
			// in WASM. The `sp-api` crate also provides a feature `disable-logging` to disable
			// all logging and thus, remove any logging from the WASM.
			log::info!("DKG offchain worker started!");

			// Since off-chain workers are just part of the runtime code, they have direct access
			// to the storage and other included pallets.
			//
			// We can easily import `frame_system` and retrieve a block hash of the parent block.
			let parent_hash = <system::Pallet<T>>::block_hash(block_number - 1u32.into());
			log::info!("Current block: {:?} (parent hash: {:?})", block_number, parent_hash);

			let num = block_number % 3u32.into();
			if num == Zero::zero() {
				let _res_nq = Self::dkg_network_query();
			// Work with data queried from network
			} else if num == T::BlockNumber::from(1u32) {
				let _res_nf = Self::dkg_node_info();
			// Work with node info data
			} else if num == T::BlockNumber::from(2u32) {
				let _res_trail = Self::dkg_trail();
			// Work with data returned by trail
			} else {
				log::error!("Unexpected behaviour!");
			}
		}
/// Offchain Worker entry point.
///
/// By implementing `fn offchain_worker` you declare a new offchain worker.
/// This function will be called when the node is fully synced and a new best block is
/// succesfuly imported.
/// Note that it's not guaranteed for offchain workers to run on EVERY block, there might
/// be cases where some blocks are skipped, or for some the worker runs twice (re-orgs),
/// so the code should be able to handle that.
/// You can use `Local Storage` API to coordinate runs of the worker.
Offchain Worker entry point.
By implementing `fn offchain_worker` you declare a new offchain worker.
This function will be called when the node is fully synced and a new best block is
succesfuly imported.
Note that it's not guaranteed for offchain workers to run on EVERY block, there might
be cases where some blocks are skipped, or for some the worker runs twice (re-orgs),
so the code should be able to handle that.
You can use `Local Storage` API to coordinate runs of the worker.
Offchain Worker entry point . By implementing ` fn offchain_worker ` you declare a new offchain worker . This function will be called when the node is fully synced and a new best block is succesfuly imported . Note that it ' s not guaranteed for offchain workers to run on EVERY block there might be cases where some blocks are skipped or for some the worker runs twice ( re - orgs ) so the code should be able to handle that . You can use ` Local Storage ` API to coordinate runs of the worker .
fn offchain_worker(block_number: T::BlockNumber) {
			// Note that having logs compiled to WASM may cause the size of the blob to increase
			// significantly. You can use `RuntimeDebug` custom derive to hide details of the types
			// in WASM. The `sp-api` crate also provides a feature `disable-logging` to disable
			// all logging and thus, remove any logging from the WASM.
			log::info!("DKG offchain worker started!");
			// Since off-chain workers are just part of the runtime code, they have direct access
			// to the storage and other included pallets.
			//
			// We can easily import `frame_system` and retrieve a block hash of the parent block.
			let parent_hash = <system::Pallet<T>>::block_hash(block_number - 1u32.into());
			log::info!("Current block: {:?} (parent hash: {:?})", block_number, parent_hash);
			let num = block_number % 3u32.into();
			if num == Zero::zero() {
				let _res_nq = Self::dkg_network_query();
			// Work with data queried from network
			} else if num == T::BlockNumber::from(1u32) {
				let _res_nf = Self::dkg_node_info();
			// Work with node info data
			} else if num == T::BlockNumber::from(2u32) {
				let _res_trail = Self::dkg_trail();
			// Work with data returned by trail
			} else {
				log::error!("Unexpected behaviour!");
			}
		}
fn offchain_worker ( block_number : T :: BlockNumber ) { // Note that having logs compiled to WASM may cause the size of the blob to increase // significantly. You can use `RuntimeDebug` custom derive to hide details of the types // in WASM. The `sp-api` crate also provides a feature `disable-logging` to disable // all logging and thus, remove any logging from the WASM. log :: info ! ( " " ) ; // Since off-chain workers are just part of the runtime code, they have direct access // to the storage and other included pallets. // // We can easily import `frame_system` and retrieve a block hash of the parent block. let parent_hash = < system :: Pallet < T > > :: block_hash ( block_number - 1u32 . into ( ) ) ; log :: info ! ( " " block_number parent_hash ) ; let num = block_number % 3u32 . into ( ) ; if num == Zero :: zero ( ) { let _res_nq = Self :: dkg_network_query ( ) ; // Work with data queried from network } else if num == T :: BlockNumber :: from ( 1u32 ) { let _res_nf = Self :: dkg_node_info ( ) ; // Work with node info data } else if num == T :: BlockNumber :: from ( 2u32 ) { let _res_trail = Self :: dkg_trail ( ) ; // Work with data returned by trail } else { log :: error ! ( " " ) ; } }
Offchain Worker entry point.
Offchain Worker entry point .
block_number
T::BlockNumber