only call get_max_usable_balance when the bid might be too high
This commit is contained in:
parent
69ecc6ce90
commit
9b44ba7c84
1 changed files with 12 additions and 10 deletions
|
@ -2037,16 +2037,18 @@ class Daemon(AuthJSONRPCServer):
|
||||||
if bid <= 0.0:
|
if bid <= 0.0:
|
||||||
raise ValueError("Bid value must be greater than 0.0")
|
raise ValueError("Bid value must be greater than 0.0")
|
||||||
|
|
||||||
balance = yield self.session.wallet.get_max_usable_balance_for_claim(name)
|
yield self.session.wallet.update_balance()
|
||||||
max_bid_amount = balance - MAX_UPDATE_FEE_ESTIMATE
|
if bid >= self.session.wallet.get_balance():
|
||||||
if balance <= MAX_UPDATE_FEE_ESTIMATE:
|
balance = yield self.session.wallet.get_max_usable_balance_for_claim(name)
|
||||||
raise InsufficientFundsError(
|
max_bid_amount = balance - MAX_UPDATE_FEE_ESTIMATE
|
||||||
"Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}"
|
if balance <= MAX_UPDATE_FEE_ESTIMATE:
|
||||||
.format(MAX_UPDATE_FEE_ESTIMATE - balance))
|
raise InsufficientFundsError(
|
||||||
elif bid > max_bid_amount:
|
"Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}"
|
||||||
raise InsufficientFundsError(
|
.format(MAX_UPDATE_FEE_ESTIMATE - balance))
|
||||||
"Please lower the bid. After accounting for the estimated fee, you only have {} left."
|
elif bid > max_bid_amount:
|
||||||
.format(max_bid_amount))
|
raise InsufficientFundsError(
|
||||||
|
"Please lower the bid. After accounting for the estimated fee, you only have {} left."
|
||||||
|
.format(max_bid_amount))
|
||||||
|
|
||||||
metadata = metadata or {}
|
metadata = metadata or {}
|
||||||
if fee is not None:
|
if fee is not None:
|
||||||
|
|
Loading…
Reference in a new issue