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

Method extractFundAllocation

lineage.go:1191–1214  ·  view source on GitHub ↗

extractFundAllocation extracts fund allocation data from transaction metadata. Parameters: - metadata map[string]interface{}: The transaction metadata. Returns: - []map[string]interface{}: The fund allocation data, or nil if not present.

(metadata map[string]interface{})

Source from the content-addressed store, hash-verified

1189// Returns:
1190// - []map[string]interface{}: The fund allocation data, or nil if not present.
1191func (l *LedgerForge) extractFundAllocation(metadata map[string]interface{}) []map[string]interface{} {
1192 if metadata == nil {
1193 return nil
1194 }
1195
1196 allocation, ok := metadata[LineageFundAllocation]
1197 if !ok {
1198 return nil
1199 }
1200
1201 alloc, ok := allocation.([]interface{})
1202 if !ok {
1203 return nil
1204 }
1205
1206 result := make([]map[string]interface{}, 0, len(alloc))
1207 for _, a := range alloc {
1208 if m, ok := a.(map[string]interface{}); ok {
1209 result = append(result, m)
1210 }
1211 }
1212
1213 return result
1214}
1215
1216// commitShadowTransactions commits all inflight shadow transactions for a parent transaction.
1217// It attempts to commit all shadows and returns an error if any fail (for outbox retry).

Callers 1

GetTransactionLineageMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected