Merge pull request #1148 from lbryio/channel-bid
Update channel balance checking to match claim balance checking
This commit is contained in:
commit
1d9c996217
2 changed files with 14 additions and 12 deletions
|
@ -17,7 +17,7 @@ at anytime.
|
||||||
* `blob_announce` error when announcing a single blob
|
* `blob_announce` error when announcing a single blob
|
||||||
* `blob_list` error when looking up blobs by stream or sd hash
|
* `blob_list` error when looking up blobs by stream or sd hash
|
||||||
* issue#1107 whereing claiming a channel with the exact amount present in wallet would give out proper error
|
* issue#1107 whereing claiming a channel with the exact amount present in wallet would give out proper error
|
||||||
*
|
* Fix channel creation to use same bid logic as claim ([1148])(https://github.com/lbryio/lbry/pull/1148)
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
* `report_bug` jsonrpc command
|
* `report_bug` jsonrpc command
|
||||||
|
|
|
@ -1852,15 +1852,17 @@ class Daemon(AuthJSONRPCServer):
|
||||||
if amount <= 0:
|
if amount <= 0:
|
||||||
raise Exception("Invalid amount")
|
raise Exception("Invalid amount")
|
||||||
|
|
||||||
|
yield self.session.wallet.update_balance()
|
||||||
|
if amount >= self.session.wallet.get_balance():
|
||||||
balance = yield self.session.wallet.get_max_usable_balance_for_claim(channel_name)
|
balance = yield self.session.wallet.get_max_usable_balance_for_claim(channel_name)
|
||||||
max_bid_amount = balance - MAX_UPDATE_FEE_ESTIMATE
|
max_bid_amount = balance - MAX_UPDATE_FEE_ESTIMATE
|
||||||
if balance <= MAX_UPDATE_FEE_ESTIMATE:
|
if balance <= MAX_UPDATE_FEE_ESTIMATE:
|
||||||
raise InsufficientFundsError(
|
raise InsufficientFundsError(
|
||||||
"Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}"
|
"Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}"
|
||||||
.format(MAX_UPDATE_FEE_ESTIMATE - balance))
|
. format(MAX_UPDATE_FEE_ESTIMATE - balance))
|
||||||
elif amount > max_bid_amount:
|
elif amount > max_bid_amount:
|
||||||
raise InsufficientFundsError(
|
raise InsufficientFundsError(
|
||||||
"Please lower the bid value, the maximum amount you can specify for this claim is {}"
|
"Please lower the bid value, the maximum amount you can specify for this channel is {}"
|
||||||
.format(max_bid_amount))
|
.format(max_bid_amount))
|
||||||
|
|
||||||
result = yield self.session.wallet.claim_new_channel(channel_name, amount)
|
result = yield self.session.wallet.claim_new_channel(channel_name, amount)
|
||||||
|
@ -2047,7 +2049,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
.format(MAX_UPDATE_FEE_ESTIMATE - balance))
|
.format(MAX_UPDATE_FEE_ESTIMATE - balance))
|
||||||
elif bid > max_bid_amount:
|
elif bid > max_bid_amount:
|
||||||
raise InsufficientFundsError(
|
raise InsufficientFundsError(
|
||||||
"Please lower the bid. After accounting for the estimated fee, you only have {} left."
|
"Please lower the bid value, the maximum amount you can specify for this claim is {}."
|
||||||
.format(max_bid_amount))
|
.format(max_bid_amount))
|
||||||
|
|
||||||
metadata = metadata or {}
|
metadata = metadata or {}
|
||||||
|
|
Loading…
Reference in a new issue