diff --git a/CHANGELOG.md b/CHANGELOG.md index 5839373bd..8ccdbb4fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ at anytime. * fixed a race condition when inserting a blob into the database (https://github.com/lbryio/lbry/issues/1129) * reflector server incorrectly responding as if it has all the blobs for a stream that was only partially uploaded to it * `publish` raising a database error when updating a claim that we don't have a file for (https://github.com/lbryio/lbry/issues/1165) + * approximations of bid when cast from float to Decimal during publish ### Deprecated * diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 1ab3f7587..bacba95fa 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -2038,15 +2038,10 @@ class Daemon(AuthJSONRPCServer): except (TypeError, URIParseError): raise Exception("Invalid name given to publish") - if isinstance(bid, (float, int)): - bid = Decimal(bid) - elif isinstance(bid, six.string_types): - try: - bid = Decimal(bid) - except InvalidOperation: - raise TypeError("Bid does not represent a valid decimal.") - else: - raise TypeError("Bid must be a decimal number represented by a string.") + try: + bid = Decimal(str(bid)) + except InvalidOperation: + raise TypeError("Bid does not represent a valid decimal.") if bid <= 0.0: raise ValueError("Bid value must be greater than 0.0") @@ -2058,11 +2053,11 @@ class Daemon(AuthJSONRPCServer): if balance <= MAX_UPDATE_FEE_ESTIMATE: raise InsufficientFundsError( "Insufficient funds, please deposit additional LBC. Minimum additional LBC needed {}" - .format(MAX_UPDATE_FEE_ESTIMATE - balance)) + .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(max_bid_amount)) + .format(max_bid_amount)) metadata = metadata or {} if fee is not None: