MCPcopy Index your code
hub / github.com/devaccuracy/ledgerforge / queueReleaseTransaction

Method queueReleaseTransaction

lineage.go:597–619  ·  view source on GitHub ↗

queueReleaseTransaction queues a transaction to release funds from the aggregate balance back to a shadow balance. Parameters: - ctx context.Context: The context for the operation. - txn *model.Transaction: The original transaction. - alloc Allocation: The allocation details. - mapping *model.Linea

(ctx context.Context, txn *model.Transaction, alloc Allocation, mapping *model.LineageMapping, sourceBalance, sourceAggBalance *model.Balance, index int)

Source from the content-addressed store, hash-verified

595// Returns:
596// - error: An error if the transaction could not be queued.
597func (l *LedgerForge) queueReleaseTransaction(ctx context.Context, txn *model.Transaction, alloc Allocation, mapping *model.LineageMapping, sourceBalance, sourceAggBalance *model.Balance, index int) error {
598 releaseTxn := &model.Transaction{
599 Source: sourceAggBalance.BalanceID,
600 Destination: alloc.BalanceID,
601 PreciseAmount: new(big.Int).Set(alloc.Amount),
602 Currency: sourceBalance.Currency,
603 Precision: txn.Precision,
604 Reference: fmt.Sprintf("%s_release_%s_%d", txn.Reference, mapping.Provider, index),
605 Description: fmt.Sprintf("Release %s funds", mapping.Provider),
606 MetaData: map[string]interface{}{
607 "_shadow_for": txn.TransactionID,
608 "_provider": mapping.Provider,
609 "_lineage_type": "release",
610 "_main_balance": sourceBalance.BalanceID,
611 "_allocation": sourceBalance.AllocationStrategy,
612 },
613 SkipQueue: true,
614 Inflight: txn.Inflight,
615 }
616
617 _, err := l.QueueTransaction(ctx, releaseTxn)
618 return err
619}
620
621// processDestinationLineage processes lineage tracking for the destination balance when it also tracks fund lineage.
622// Uses pre-created destination balances to avoid nested lock acquisition (locks are already held by caller).

Callers 1

processAllocationsMethod · 0.95

Calls 2

QueueTransactionMethod · 0.95
SetMethod · 0.65

Tested by

no test coverage detected