3

Two functions batch and batch_all are slightly similar

Questions:

  • When to use batch and when to use batch_all?

1 Answer 1

4

The docs of both mention the difference. For batch it is:

/// Send a batch of dispatch calls.

And for batch_all it is:

/// Send a batch of dispatch calls and atomically execute them.

So, when you send a batch with batch with 5 calls. The third call in the batch fails, the changes of the first two calls are not reverted and committed to the block. batch_all would rollback all changes done to the state. However, the user would still pay for the transaction even if all changes are rolled back.

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.