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

Function collectQueuedCoalescingBalanceIDs

transaction.go:1408–1428  ·  view source on GitHub ↗
(transactions []*model.Transaction)

Source from the content-addressed store, hash-verified

1406}
1407
1408func collectQueuedCoalescingBalanceIDs(transactions []*model.Transaction) []string {
1409 seen := make(map[string]struct{}, len(transactions)*2)
1410 ids := make([]string, 0, len(transactions)*2)
1411 for _, txn := range transactions {
1412 if txn == nil {
1413 continue
1414 }
1415 for _, id := range []string{txn.Source, txn.Destination} {
1416 if id == "" {
1417 continue
1418 }
1419 if _, ok := seen[id]; ok {
1420 continue
1421 }
1422 seen[id] = struct{}{}
1423 ids = append(ids, id)
1424 }
1425 }
1426 sort.Strings(ids)
1427 return ids
1428}
1429
1430func (l *LedgerForge) acquireBalanceSetLock(ctx context.Context, balanceIDs []string) (*redlock.MultiLocker, error) {
1431 ctx, span := tracer.Start(ctx, "Acquiring Balance Set Lock")

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected