mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
qt send tab: (fix) allow user to set lower fees if "not enough funds"
Previously if the user tried to pay an invoice, we tried to construct a tx with the desired feerate. If this raise NotEnoughFunds, we would just show the error and not let the user change the feerate. related: https://github.com/spesmilo/electrum/issues/6136#issuecomment-622254754 (method 2)
This commit is contained in:
parent
b9bb78a1db
commit
5bf3115a4a
2 changed files with 12 additions and 3 deletions
|
@ -104,7 +104,13 @@ class TxEditor:
|
||||||
if use_rbf:
|
if use_rbf:
|
||||||
self.tx.set_rbf(True)
|
self.tx.set_rbf(True)
|
||||||
|
|
||||||
|
def have_enough_funds_assuming_zero_fees(self) -> bool:
|
||||||
|
try:
|
||||||
|
tx = self.make_tx(0)
|
||||||
|
except NotEnoughFunds:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1594,8 +1594,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||||
output_value = '!' if '!' in output_values else sum(output_values)
|
output_value = '!' if '!' in output_values else sum(output_values)
|
||||||
d = ConfirmTxDialog(window=self, make_tx=make_tx, output_value=output_value, is_sweep=is_sweep)
|
d = ConfirmTxDialog(window=self, make_tx=make_tx, output_value=output_value, is_sweep=is_sweep)
|
||||||
if d.not_enough_funds:
|
if d.not_enough_funds:
|
||||||
self.show_message(_('Not Enough Funds'))
|
# Check if we had enough funds excluding fees,
|
||||||
return
|
# if so, still provide opportunity to set lower fees.
|
||||||
|
if not d.have_enough_funds_assuming_zero_fees():
|
||||||
|
self.show_message(_('Not Enough Funds'))
|
||||||
|
return
|
||||||
cancelled, is_send, password, tx = d.run()
|
cancelled, is_send, password, tx = d.run()
|
||||||
if cancelled:
|
if cancelled:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue