Browse Source

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)
master
SomberNight 5 years ago
parent
commit
5bf3115a4a
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/gui/qt/confirm_tx_dialog.py
  2. 7
      electrum/gui/qt/main_window.py

8
electrum/gui/qt/confirm_tx_dialog.py

@ -104,7 +104,13 @@ class TxEditor:
if use_rbf:
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

7
electrum/gui/qt/main_window.py

@ -1594,8 +1594,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
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)
if d.not_enough_funds:
self.show_message(_('Not Enough Funds'))
return
# Check if we had enough funds excluding fees,
# 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()
if cancelled:
return

Loading…
Cancel
Save