/// Determine if can trigger OCW based on the next offchain trigger block delay mechanism
Determine if can trigger OCW based on the next offchain trigger block delay mechanism
Determine if can trigger OCW based on the next offchain trigger block delay mechanism
fn should_trigger_offchain(block_number: T::BlockNumber) -> bool {
		match StorageValueRef::persistent(NEXT_OFFCHAIN_TRIGGER_BLOCK).get::<T::BlockNumber>() {
			Ok(Some(next_offchain_trigger)) if block_number >= next_offchain_trigger => {
				log::info!("Offchain trigger block encountered!");
				true
			}
			Ok(Some(_)) => {
				log::info!("Offchain trigger attempted too soon!");
				false
			}
			Ok(None) => {
				log::info!("Offchain trigger block initiated!");
				true
			}
			_ => {
				log::info!("Offchain trigger not readable!");
				false
			}
		}
	}
fn should_trigger_offchain ( block_number : T :: BlockNumber ) -> bool { match StorageValueRef :: persistent ( NEXT_OFFCHAIN_TRIGGER_BLOCK ) . get :: < T :: BlockNumber > ( ) { Ok ( Some ( next_offchain_trigger ) ) if block_number >= next_offchain_trigger => { log :: info ! ( " " ) ; true } Ok ( Some ( _ ) ) => { log :: info ! ( " " ) ; false } Ok ( None ) => { log :: info ! ( " " ) ; true } _ => { log :: info ! ( " " ) ; false } } }
Determine if can trigger OCW based on the next offchain trigger block delay mechanism
Determine if can trigger OCW based on the next offchain trigger block delay mechanism
block_number
T::BlockNumber