You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The offchain-worker functionality seems to only trigger every third time I send a transaction. This is without any substantial modification of the code.
Repro steps:
cloned the recipes repo: git clone https://github.com/substrate-developer-hub/recipes.git cd recipes
edit nodes/kitchen-node/Cargo.toml:
comment out line 51 (super-runtime configuration)
uncomment out line 59 (ocw-runtime configuration)
then cd nodes/kitchen-node cargo build --release --features ocw cargo run -- --dev --tmp
then open Polkadot.js app explorer, switch to our Development > Local Node:
127.0.0.1:9944
Attempt Developer > Extrinsics > ocwDemo > submitNumberSigned > any number (1) > Submit Transaction
Yeah! But What is your problem ? With my understanding, off chain worker executes when 1 block finalize, so in function fn offchain_worker(block_number: T::BlockNumber) has 1 parameter block_number. In recipes code, they set default that block_number % 4 that you can choice any function offchain execution. Function fetch_github_info execute in block_number 3 or 7,... (_Because frame_system::block_number is initialized with n+1 , actually block_number is n )
This is code from recipes that indicate your describe:
The offchain-worker functionality seems to only trigger every third time I send a transaction. This is without any substantial modification of the code.
Repro steps:
cloned the recipes repo:
git clone https://github.com/substrate-developer-hub/recipes.git
cd recipes
edit nodes/kitchen-node/Cargo.toml:
comment out line 51 (super-runtime configuration)
uncomment out line 59 (ocw-runtime configuration)
then
cd nodes/kitchen-node
cargo build --release --features ocw
cargo run -- --dev --tmp
then open Polkadot.js app explorer, switch to our Development > Local Node:
127.0.0.1:9944
Attempt Developer > Extrinsics > ocwDemo > submitNumberSigned > any number (1) > Submit Transaction
We'll see "No off-chain indexing data retrieved".
The same will occur if we subimit the same extrinsic again.
However, if we submit it a third time, we'll see success:
If we submit it a fourth or fifth time, we'll return to the initial failures ("No local account available") .
On a sixth attempt, we'll get success again (this time, the results will be cached, so the success is slightly different):
This same cycle repeats. Only every third transaction appears to no trigger a "No local account available" debug line.
The text was updated successfully, but these errors were encountered: