validateQueuedBatchCurrencies ensures that every transaction in a coalesced batch uses the same currency before any lock or balance work begins.
(transactions []*model.Transaction)
| 979 | // validateQueuedBatchCurrencies ensures that every transaction in a coalesced batch uses the |
| 980 | // same currency before any lock or balance work begins. |
| 981 | func validateQueuedBatchCurrencies(transactions []*model.Transaction) error { |
| 982 | if len(transactions) == 0 { |
| 983 | return nil |
| 984 | } |
| 985 | |
| 986 | currency := transactions[0].Currency |
| 987 | for _, txn := range transactions[1:] { |
| 988 | if txn.Currency != currency { |
| 989 | return fmt.Errorf("coalescing batch contains multiple currencies") |
| 990 | } |
| 991 | } |
| 992 | |
| 993 | return nil |
| 994 | } |
| 995 | |
| 996 | // persistQueuedTransactionBatchLocked prepares every transaction against the shared in-memory |
| 997 | // balance set and persists the final balance and transaction state atomically. |
no outgoing calls
no test coverage detected