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)
|
* 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
|
* 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)
|
* `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
|
### Deprecated
|
||||||
*
|
*
|
||||||
|
|
|
@ -2038,15 +2038,10 @@ class Daemon(AuthJSONRPCServer):
|
||||||
except (TypeError, URIParseError):
|
except (TypeError, URIParseError):
|
||||||
raise Exception("Invalid name given to publish")
|
raise Exception("Invalid name given to publish")
|
||||||
|
|
||||||
if isinstance(bid, (float, int)):
|
try:
|
||||||
bid = Decimal(bid)
|
bid = Decimal(str(bid))
|
||||||
elif isinstance(bid, six.string_types):
|
except InvalidOperation:
|
||||||
try:
|
raise TypeError("Bid does not represent a valid decimal.")
|
||||||
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.")
|
|
||||||
|
|
||||||
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")
|
||||||
|
@ -2058,11 +2053,11 @@ class Daemon(AuthJSONRPCServer):
|
||||||
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 bid > max_bid_amount:
|
elif bid > 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 claim is {}."
|
||||||
.format(max_bid_amount))
|
.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