RecordTransaction records a transaction by validating, processing balances, and finalizing the transaction. It starts a tracing span, acquires a lock, and performs the necessary steps to record the transaction. Parameters: - ctx context.Context: The context for the operation. - transaction *model.T
(ctx context.Context, transaction *model.Transaction)
| 771 | // - *model.Transaction: A pointer to the recorded Transaction model. |
| 772 | // - error: An error if the transaction could not be recorded. |
| 773 | func (l *LedgerForge) RecordTransaction(ctx context.Context, transaction *model.Transaction) (*model.Transaction, error) { |
| 774 | result, err := l.executeTransactionPlan(ctx, l.planTransactionExecution(transaction, false, false)) |
| 775 | if err != nil { |
| 776 | return nil, err |
| 777 | } |
| 778 | return result.transaction, nil |
| 779 | } |
| 780 | |
| 781 | // recordTransactionSingle preserves the existing direct transaction-processing semantics by |
| 782 | // running the single-transaction flow under the balance lock. |