4

On a parachain (Substrate polkadot-v0.9.20 branch), I am trying to trigger some offchain tasks using an offchain worker in my pallet, but the task is not triggered. I checked that the on_finalize hook is correctly triggered, but not the offchain_worker...
I also tried the --offchain-worker always command line flag, without any success.

Is this supposed to work on parachain nodes ?

Thanks for your help.

2 Answers 2

1

Did you initialise the offchain worker in service.rs file? These lines have to be added to initialise offchain worker https://github.com/substrate-developer-hub/substrate-node-template/blob/150c6c9e66bd4e866cfd4704d4d2a16799edc2c0/node/src/service.rs#L205

1

Yes, it has to work too. As suggested in the previous answer check that you are doing the initialisation.

Do the Substrate tutorial: Add offchain workers to see how to implement the pallet in the runtime

Or see this previous StackExchange answer with an example: Working up-to-date complete source code for offchain workers?

Another guide that is a bit old, but worth to check is this: Transactions in Off-chain Workers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.