MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / validateQueuedBatchCurrencies

Function validateQueuedBatchCurrencies

transaction.go:981–994  ·  view source on GitHub ↗

validateQueuedBatchCurrencies ensures that every transaction in a coalesced batch uses the same currency before any lock or balance work begins.

(transactions []*model.Transaction)

Source from the content-addressed store, hash-verified

979// validateQueuedBatchCurrencies ensures that every transaction in a coalesced batch uses the
980// same currency before any lock or balance work begins.
981func 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.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected