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
- Open a builder with
Client::new_transaction_batch. - 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. - Finalize with
BatchBuilder::submit. This assembles aProposedBatch, 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
- All accounts pushed into the batch must be tracked by the client’s store (otherwise the first
push for that account fails with
crate::ClientError::AccountDataNotFound). - Locked accounts are rejected with
crate::ClientError::AccountLocked. - No two transactions in a batch may consume the same input note (rejected with
BatchBuilderError::DuplicateInputNote). - The builder is succeed-only: every transaction must be pushed successfully for the batch to
reach
submit.
§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:
BatchBuilderError::BatchSubmittedButUpdateBuildFailed— building one of the per-txTransactionStoreUpdates failed.BatchBuilderError::BatchSubmittedButApplyFailed— applying the updates atomically to the local store failed.
In both cases the recovery path is to trigger sync_state to reconcile.
Structs§
- Batch
Builder - Accumulates transactions from one or more local accounts and submits them as one proven
batch via the node’s
SubmitProvenBatchendpoint. See the module-level docs for the full usage and error semantics.
Enums§
- Batch
Builder Error - Errors specific to
BatchBuilderconstruction and operation.