queuedBatchReferenceSets prepares the prefetched and existing reference sets used by batch validation when batch reference checking is enabled.
(ctx context.Context, transactions []*model.Transaction)
| 1042 | // queuedBatchReferenceSets prepares the prefetched and existing reference sets used by batch |
| 1043 | // validation when batch reference checking is enabled. |
| 1044 | func (l *LedgerForge) queuedBatchReferenceSets(ctx context.Context, transactions []*model.Transaction) (map[string]struct{}, map[string]struct{}, error) { |
| 1045 | prefetchedReferences := make(map[string]struct{}) |
| 1046 | existingReferences := make(map[string]struct{}) |
| 1047 | if !l.batchReferenceCheckEnabled() { |
| 1048 | return prefetchedReferences, existingReferences, nil |
| 1049 | } |
| 1050 | |
| 1051 | prefetchedReferences, existingReferences, err := l.getQueuedBatchExistingReferences(ctx, transactions) |
| 1052 | if err != nil { |
| 1053 | return nil, nil, fmt.Errorf("failed to validate coalesced transaction references: %w", err) |
| 1054 | } |
| 1055 | |
| 1056 | return prefetchedReferences, existingReferences, nil |
| 1057 | } |
| 1058 | |
| 1059 | // prepareQueuedBatchTransaction performs the per-transaction work inside a coalesced batch: |
| 1060 | // hooks, reference validation, in-memory balance application, and persistence shaping. |
no test coverage detected