Merge pull request #1257 from lbryio/fix-lex-floats
Fix approximations in bid during publish
This commit is contained in:
commit
fa0dc128e6
2 changed files with 7 additions and 11 deletions
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue