Skip to content

Commit 541caa4

Browse files
committed
fix bug in faircoin spending_limit
1 parent cc77724 commit 541caa4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

valuenetwork/valueaccounting/models.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,13 +4508,16 @@ def spending_limit(self):
45084508
from valuenetwork.valueaccounting.faircoin_utils import network_fee
45094509
balance = self.digital_currency_balance() #get_address_balance(address)
45104510
newbalance = self.digital_currency_balance_unconfirmed()
4511-
if balance:
4512-
if newbalance < balance:
4513-
bal = newbalance
4514-
else:
4515-
bal = balance #bal = Decimal(balance[0]) / FAIRCOIN_DIVISOR
4516-
fee = Decimal(network_fee()) / FAIRCOIN_DIVISOR
4517-
limit = bal - fee
4511+
try:
4512+
if balance:
4513+
if newbalance < balance:
4514+
bal = newbalance
4515+
else:
4516+
bal = balance #bal = Decimal(balance[0]) / FAIRCOIN_DIVISOR
4517+
fee = Decimal(network_fee()) / FAIRCOIN_DIVISOR
4518+
limit = bal - fee
4519+
except InvalidOperation:
4520+
limit = Decimal("0.0")
45184521
return limit
45194522

45204523
def context_agents(self):

0 commit comments

Comments
 (0)