Skip to main content

Module batch

Module batch 

Source
Expand description

Stacks multiple transactions across one or more local accounts and submits them as one proven batch via the node’s SubmitProvenBatch endpoint.

§Flow

  1. Open a builder with Client::new_transaction_batch.
  2. Add transactions via BatchBuilder::push. The first push targeting an account lazily loads its current state from the store; later pushes for that same account see the post-state of the previous push.
  3. Finalize with BatchBuilder::submit. This assembles a ProposedBatch, proves it, submits it to the node, and atomically applies the per-transaction updates to the local store.

§Multi-account semantics

Each push specifies which local account the transaction targets. A single batch can contain transactions from any combination of local accounts. Per-account in-memory state stacks for repeated pushes against the same account.

§In-batch cross-account note flow

A transaction in the batch may consume a note produced by an earlier transaction in the same batch — even if the producer and consumer target different accounts. The user extracts the expected output note from the producing request via TransactionRequest::expected_output_own_notes and feeds it as an input to the consuming request. Push order must respect producer-before-consumer.

§Constraints

§Error semantics after RPC accept

Once the node accepts the batch, the local store still needs to be updated. If that step fails, the caller receives one of two errors that both carry the accepted block_num:

In both cases the recovery path is to trigger sync_state to reconcile.

Structs§

BatchBuilder
Accumulates transactions from one or more local accounts and submits them as one proven batch via the node’s SubmitProvenBatch endpoint. See the module-level docs for the full usage and error semantics.

Enums§

BatchBuilderError
Errors specific to BatchBuilder construction and operation.