From 51379946d960eec1492a1060160c7082d6d02a8c Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Wed, 4 Dec 2013 11:58:53 +0200 Subject: [PATCH] skip the general balance from counter --- engine/units_counter.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/units_counter.go b/engine/units_counter.go index 81fdd399d..5b9a90d5e 100644 --- a/engine/units_counter.go +++ b/engine/units_counter.go @@ -23,7 +23,7 @@ type UnitsCounter struct { Direction string BalanceId string // Units float64 - Balances BalanceChain + Balances BalanceChain // first balance is the general one (no destination) } func (uc *UnitsCounter) initBalances(ats []*ActionTrigger) { @@ -59,7 +59,10 @@ func (uc *UnitsCounter) GetGeneralBalance() *Balance { func (uc *UnitsCounter) addUnits(amount float64, prefix string) { counted := false if prefix != "" { - for _, mb := range uc.Balances { + for _, mb := range uc.Balances[1:] { // skip the general balance + if !mb.HasDestination() { + continue + } dest, err := storageGetter.GetDestination(mb.DestinationId, false) if err != nil { Logger.Err("Counter: unknown destination: " + mb.DestinationId)