buildTransactionExecutionWork converts an in-memory-applied transaction into the shared persistence and post-commit work shape used by both single and batched execution paths.
(ctx context.Context, transaction *model.Transaction, sourceBalance, destinationBalance *model.Balance)
| 1257 | // buildTransactionExecutionWork converts an in-memory-applied transaction into the shared |
| 1258 | // persistence and post-commit work shape used by both single and batched execution paths. |
| 1259 | func (l *LedgerForge) buildTransactionExecutionWork(ctx context.Context, transaction *model.Transaction, sourceBalance, destinationBalance *model.Balance) (queuedBatchPostCommitWork, bool) { |
| 1260 | transaction = l.updateTransactionDetails(ctx, transaction, sourceBalance, destinationBalance) |
| 1261 | if transaction.PreciseAmount != nil && transaction.PreciseAmount.Cmp(big.NewInt(0)) == 0 { |
| 1262 | return queuedBatchPostCommitWork{ |
| 1263 | transaction: transaction, |
| 1264 | sourceBalance: sourceBalance, |
| 1265 | destinationBalance: destinationBalance, |
| 1266 | }, true |
| 1267 | } |
| 1268 | |
| 1269 | return queuedBatchPostCommitWork{ |
| 1270 | transaction: transaction, |
| 1271 | sourceBalance: sourceBalance, |
| 1272 | destinationBalance: destinationBalance, |
| 1273 | outbox: l.prepareTransactionOutbox(ctx, transaction, sourceBalance, destinationBalance), |
| 1274 | }, false |
| 1275 | } |
| 1276 | |
| 1277 | // persistSingleTransactionExecutionWork atomically persists one prepared transaction, its |
| 1278 | // updated balances, and any lineage outbox using the shared execution work shape. |
no test coverage detected