handleSplitTransactions attempts to split a transaction into multiple transactions if needed. It starts a tracing span, attempts to split the transaction, and validates the result. Parameters: - ctx context.Context: The context for the operation. - transaction *model.Transaction: The transaction to
(ctx context.Context, transaction *model.Transaction)
| 1884 | // - []*model.Transaction: A slice of split transactions, or empty if no split is needed. |
| 1885 | // - error: An error if the transaction splitting fails. |
| 1886 | func (l *LedgerForge) handleSplitTransactions(ctx context.Context, transaction *model.Transaction) ([]*model.Transaction, error) { |
| 1887 | ctx, span := tracer.Start(ctx, "HandleSplitTransactions") |
| 1888 | defer span.End() |
| 1889 | |
| 1890 | transactions, err := transaction.SplitTransactionPrecise(ctx) |
| 1891 | if err != nil { |
| 1892 | return nil, fmt.Errorf("failed to split transaction: %w", err) |
| 1893 | } |
| 1894 | return transactions, nil |
| 1895 | } |
| 1896 | |
| 1897 | // processTxns handles the processing of transactions based on whether they are split or single. |
| 1898 | // It delegates to the appropriate processing function based on the presence of split transactions. |
no test coverage detected