From d04cf1df4407ccf95a403726d97bcb9bfa20b038 Mon Sep 17 00:00:00 2001 From: gezimbll Date: Fri, 28 Feb 2025 11:46:06 +0100 Subject: [PATCH] updated negative balance to not give warning when AllowNegative set to true --- engine/balances.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/balances.go b/engine/balances.go index a16ece674..3a21e58f4 100644 --- a/engine/balances.go +++ b/engine/balances.go @@ -685,7 +685,9 @@ func (b *Balance) debit(cd *CallDescriptor, ub *Account, moneyBalances Balances, } } if cost != 0 && moneyBal == nil && (!dryRun || ub.AllowNegative) { // Fix for issue #685 - utils.Logger.Warning(fmt.Sprintf(" Going negative on account %s with AllowNegative: false", cd.GetAccountKey())) + if !ub.AllowNegative { + utils.Logger.Warning(fmt.Sprintf(" Going negative on account %s with AllowNegative: false", cd.GetAccountKey())) + } moneyBal = ub.GetDefaultMoneyBalance() } canDebitCost = b.GetValue() >= amount && (moneyBal != nil || cost == 0)