From 16f2a5429b3cdb2403a0c6c0a2f45c9f0ad19985 Mon Sep 17 00:00:00 2001 From: hackrush Date: Fri, 9 Mar 2018 20:36:00 +0530 Subject: [PATCH] Name and output message fix. --- lbrynet/core/Wallet.py | 2 +- lbrynet/daemon/Daemon.py | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lbrynet/core/Wallet.py b/lbrynet/core/Wallet.py index 0eb25f318..f739a5849 100644 --- a/lbrynet/core/Wallet.py +++ b/lbrynet/core/Wallet.py @@ -503,7 +503,7 @@ class Wallet(object): log.info("Preparing to make certificate claim for %s", channel_name) channel_claim = yield self._claim_certificate(parsed_channel_name.name, amount) if not channel_claim['success']: - msg = 'Claiming of {} failed: {}'.format(channel_name, channel_claim['reason']) + msg = 'Claiming of channel {} failed: {}'.format(channel_name, channel_claim['reason']) log.error(msg) raise Exception(msg) yield self.save_claim(self._get_temp_claim_info(channel_claim, channel_name, amount)) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 99e0c8efd..12935af24 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -1852,11 +1852,16 @@ class Daemon(AuthJSONRPCServer): if amount <= 0: raise Exception("Invalid amount") - amt = yield self.session.wallet.get_max_usable_balance_for_claim(channel_name) - if amount > amt: + balance = yield self.session.wallet.get_max_usable_balance_for_claim(channel_name) + max_bid_amount = balance - MAX_UPDATE_FEE_ESTIMATE + if balance <= MAX_UPDATE_FEE_ESTIMATE: + raise InsufficientFundsError( + "Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}" + .format(MAX_UPDATE_FEE_ESTIMATE - balance)) + elif amount > max_bid_amount: raise InsufficientFundsError( "Please lower the bid value, the maximum amount you can specify for this claim is {}" - .format(amt - MAX_UPDATE_FEE_ESTIMATE)) + .format(max_bid_amount)) result = yield self.session.wallet.claim_new_channel(channel_name, amount) self.analytics_manager.send_new_channel() @@ -2032,11 +2037,16 @@ class Daemon(AuthJSONRPCServer): if bid <= 0.0: raise ValueError("Bid value must be greater than 0.0") - amt = yield self.session.wallet.get_max_usable_balance_for_claim(name) - if bid > amt: + balance = yield self.session.wallet.get_max_usable_balance_for_claim(name) + max_bid_amount = balance - MAX_UPDATE_FEE_ESTIMATE + if balance <= MAX_UPDATE_FEE_ESTIMATE: + raise InsufficientFundsError( + "Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}" + .format(MAX_UPDATE_FEE_ESTIMATE - balance)) + elif bid > max_bid_amount: raise InsufficientFundsError( "Please lower the bid value, the maximum amount you can specify for this claim is {}" - .format(amt - MAX_UPDATE_FEE_ESTIMATE)) + .format(max_bid_amount)) metadata = metadata or {} if fee is not None: