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

Function processLeftDistribution

model/transaction.go:284–298  ·  view source on GitHub ↗

processLeftDistribution handles the "left" distribution type

(distributions []Distribution, state *distributionState)

Source from the content-addressed store, hash-verified

282
283// processLeftDistribution handles the "left" distribution type
284func processLeftDistribution(distributions []Distribution, state *distributionState) error {
285 for _, dist := range distributions {
286 if !dist.isLeftDistribution() {
287 continue
288 }
289
290 if _, exists := state.result[dist.Identifier]; exists {
291 return errors.New("multiple identifiers with 'left' distribution")
292 }
293
294 state.result[dist.Identifier] = state.amountLeftDec.BigInt()
295 break
296 }
297 return nil
298}
299
300// balanceDistributions ensures the sum of all distributions equals the total amount
301func balanceDistributions(state *distributionState) {

Callers 1

Calls 1

isLeftDistributionMethod · 0.80

Tested by

no test coverage detected