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

Method queuedBatchReferenceSets

transaction.go:1044–1057  ·  view source on GitHub ↗

queuedBatchReferenceSets prepares the prefetched and existing reference sets used by batch validation when batch reference checking is enabled.

(ctx context.Context, transactions []*model.Transaction)

Source from the content-addressed store, hash-verified

1042// queuedBatchReferenceSets prepares the prefetched and existing reference sets used by batch
1043// validation when batch reference checking is enabled.
1044func (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.

Tested by

no test coverage detected