From 165fad5849d4d918cdd6029bfa0a2f6cfc959ea6 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Mon, 1 Sep 2014 15:26:04 +0300 Subject: [PATCH] clean expired balances on debit --- engine/account.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/account.go b/engine/account.go index 1964e60d4..39ff410dd 100644 --- a/engine/account.go +++ b/engine/account.go @@ -111,9 +111,10 @@ func (ub *Account) debitBalanceAction(a *Action) error { } found := false id := a.BalanceType + a.Direction + ub.CleanExpiredBalances() for _, b := range ub.BalanceMap[id] { if b.IsExpired() { - continue // we can clean expired balances balances here + continue // just to be safe (cleaned expired balances above) } if b.Equal(a.Balance) { b.SubstractAmount(a.Balance.Value)