Skip to content

Commit fe7f0a9

Browse files
authored
Fix: Off-chain-worker example (#13300)
* fix: divider * update comment
1 parent 47ecdb6 commit fe7f0a9

File tree

1 file changed

+2
-3
lines changed
  • frame/examples/offchain-worker/src

1 file changed

+2
-3
lines changed

frame/examples/offchain-worker/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,15 +410,14 @@ impl<T: Config> Pallet<T> {
410410
match res {
411411
// The value has been set correctly, which means we can safely send a transaction now.
412412
Ok(block_number) => {
413-
// Depending if the block is even or odd we will send a `Signed` or `Unsigned`
414-
// transaction.
413+
// We will send different transactions based on a random number.
415414
// Note that this logic doesn't really guarantee that the transactions will be sent
416415
// in an alternating fashion (i.e. fairly distributed). Depending on the execution
417416
// order and lock acquisition, we may end up for instance sending two `Signed`
418417
// transactions in a row. If a strict order is desired, it's better to use
419418
// the storage entry for that. (for instance store both block number and a flag
420419
// indicating the type of next transaction to send).
421-
let transaction_type = block_number % 3u32.into();
420+
let transaction_type = block_number % 4u32.into();
422421
if transaction_type == Zero::zero() {
423422
TransactionType::Signed
424423
} else if transaction_type == T::BlockNumber::from(1u32) {

0 commit comments

Comments
 (0)