From 961082606ed13358a48010c749b16c8cbfc6ee5e Mon Sep 17 00:00:00 2001 From: nahuseyoum <39748285+nahuseyoum@users.noreply.github.com> Date: Tue, 17 Mar 2020 17:52:00 +0000 Subject: [PATCH] bug fix - if statement logic (#5283) if statement logic for recently sent block was inverted. --- substrate/frame/example-offchain-worker/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/example-offchain-worker/src/lib.rs b/substrate/frame/example-offchain-worker/src/lib.rs index d4905d26b0..b05d7c38da 100644 --- a/substrate/frame/example-offchain-worker/src/lib.rs +++ b/substrate/frame/example-offchain-worker/src/lib.rs @@ -276,7 +276,7 @@ impl Module { match last_send { // If we already have a value in storage and the block number is recent enough // we avoid sending another transaction at this time. - Some(Some(block)) if block + T::GracePeriod::get() < block_number => { + Some(Some(block)) if block_number < block + T::GracePeriod::get() => { Err(RECENTLY_SENT) }, // In every other case we attempt to acquire the lock and send a transaction.