(ctx context.Context, transactions []*model.Transaction)
| 1499 | } |
| 1500 | |
| 1501 | func (l *LedgerForge) getQueuedBatchExistingReferences(ctx context.Context, transactions []*model.Transaction) (map[string]struct{}, map[string]struct{}, error) { |
| 1502 | references := make([]string, 0, len(transactions)) |
| 1503 | prefetched := make(map[string]struct{}, len(transactions)) |
| 1504 | for _, txn := range transactions { |
| 1505 | if txn == nil || txn.Reference == "" { |
| 1506 | continue |
| 1507 | } |
| 1508 | if _, ok := prefetched[txn.Reference]; ok { |
| 1509 | continue |
| 1510 | } |
| 1511 | prefetched[txn.Reference] = struct{}{} |
| 1512 | references = append(references, txn.Reference) |
| 1513 | } |
| 1514 | |
| 1515 | existing, err := l.datasource.GetExistingTransactionReferences(ctx, references) |
| 1516 | if err != nil { |
| 1517 | return nil, nil, err |
| 1518 | } |
| 1519 | return prefetched, existing, nil |
| 1520 | } |
| 1521 | |
| 1522 | func (l *LedgerForge) validateQueuedBatchTransactionReference(ctx context.Context, transaction *model.Transaction, prefetchedReferences, existingReferences, batchReferences map[string]struct{}) error { |
| 1523 | if transaction == nil { |
no test coverage detected