I have to submit 2 signed extrinsics through off-chain worker. The code structure of my off-chain worker is like this:
fn offchain_worker(block_number: BlockNumberFor<T>) {
if !sp_io::offchain::is_validator() {
return;
}
log::info!("Hello from ocw!!!!!!!!!!");
if (block_number.saturated_into::<u32>() % 100 as u32) != 0 {
return;
}
let signer = Signer::<T, T::IdentifierId>::any_account();
if !signer.can_sign() {
log::error!("No local accounts available");
return;
}
// First submission of signed transaction
let _ = signer.send_signed_transaction(|_account| Call::set_validator {});
// Some time taking logic, which also included hitting multiple HTTP Requests
// 2 Second submission of signed transaction.
if let Some((_, res)) = signer.send_signed_transaction(|_account| {
Call::second_submission_call {
setting_id,
}
}) {
match res {
Ok(_) => {
// Extrinsic call succeeded
log::info!("Extrinsic call succeeded");
},
Err(e) => {
log::error!("Error ");
}
}
First submission of signed transaction is done successfully. But It skips to call second_submission_call
. However it gives me message Extrinsic call succeeded
without submitting the call. This also does not give any error in log.
Please let me know if I am missing anything. I am starting my node in dev mode using ./target/release/mychain --dev
.