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

Function coalescingBalancesForTransaction

transaction.go:1487–1499  ·  view source on GitHub ↗
(balancesByID map[string]*model.Balance, txn *model.Transaction)

Source from the content-addressed store, hash-verified

1485}
1486
1487func coalescingBalancesForTransaction(balancesByID map[string]*model.Balance, txn *model.Transaction) (*model.Balance, *model.Balance, error) {
1488 sourceBalance, ok := balancesByID[txn.Source]
1489 if !ok || sourceBalance == nil {
1490 return nil, nil, fmt.Errorf("missing source balance %s for coalesced transaction", txn.Source)
1491 }
1492
1493 destinationBalance, ok := balancesByID[txn.Destination]
1494 if !ok || destinationBalance == nil {
1495 return nil, nil, fmt.Errorf("missing destination balance %s for coalesced transaction", txn.Destination)
1496 }
1497
1498 return sourceBalance, destinationBalance, nil
1499}
1500
1501func (l *LedgerForge) getQueuedBatchExistingReferences(ctx context.Context, transactions []*model.Transaction) (map[string]struct{}, map[string]struct{}, error) {
1502 references := make([]string, 0, len(transactions))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected