-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include existing claim amount in the max biddable amount for a publish #1108
Changes from 3 commits
d72ef78
2368433
3754f34
dafa80c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ | |
} | ||
|
||
SHORT_ID_LEN = 20 | ||
MAX_UPDATE_FEE_ESTIMATE = 0.3 | ||
|
||
|
||
class IterableContainer(object): | ||
|
@@ -715,8 +716,6 @@ def _publish_stream(self, name, bid, claim_dict, file_path=None, certificate_id= | |
publisher = Publisher(self.session, self.lbry_file_manager, self.session.wallet, | ||
certificate_id) | ||
parse_lbry_uri(name) | ||
if bid <= 0.0: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason this is here is because otherwise we have to possibly make a stream before lbryum would tell us something is wrong |
||
raise Exception("Invalid bid") | ||
if not file_path: | ||
stream_hash = yield self.storage.get_stream_hash_for_sd_hash(claim_dict['stream']['source']['source']) | ||
claim_out = yield publisher.publish_stream(name, bid, claim_dict, stream_hash, claim_address, | ||
|
@@ -2007,9 +2006,11 @@ def jsonrpc_publish(self, name, bid, metadata=None, file_path=None, fee=None, ti | |
if bid <= 0.0: | ||
raise ValueError("Bid value must be greater than 0.0") | ||
|
||
if bid >= self.session.wallet.get_balance(): | ||
raise InsufficientFundsError('Insufficient funds. ' \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as the other bid check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, this should be formatted as something like: raise InsufficientFundsError(
'Insufficient funds. Make sure you have enough LBC to deposit.'
) Or perhaps, if the message is constant it should just be built-in to the InsufficientFundsError. How many different messages do we need for this exception? |
||
'Make sure you have enough LBC to deposit') | ||
amt = yield self.session.wallet.get_max_usable_balance_for_claim(name) | ||
if bid > amt: | ||
raise InsufficientFundsError( | ||
"Please lower the bid value, the maximum amount you can specify for this claim is {}" | ||
.format(amt - MAX_UPDATE_FEE_ESTIMATE)) | ||
|
||
metadata = metadata or {} | ||
if fee is not None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a matching dummy method in
Wallet
tooThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!