Browse Source

qt send tab: mention frozen balance if "not enough funds" in more cases

fixes #6912
patch-4
SomberNight 4 years ago
parent
commit
13c45bd798
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/gui/qt/confirm_tx_dialog.py
  2. 19
      electrum/gui/qt/main_window.py

7
electrum/gui/qt/confirm_tx_dialog.py

@ -229,12 +229,7 @@ class ConfirmTxDialog(TxEditor, WindowModalDialog):
self._update_amount_label()
if self.not_enough_funds:
text = _("Not enough funds")
c, u, x = self.wallet.get_frozen_balance()
if c+u+x:
text += " ({} {} {})".format(
self.main_window.format_amount(c + u + x).strip(), self.main_window.base_unit(), _("are frozen")
)
text = self.main_window.get_text_not_enough_funds_mentioning_frozen()
self.toggle_send_button(False, message=text)
return

19
electrum/gui/qt/main_window.py

@ -1411,10 +1411,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
# Check if we had enough funds excluding fees,
# if so, still provide opportunity to set lower fees.
tx = make_tx(0)
except (MultipleSpendMaxTxOutputs, NotEnoughFunds) as e:
except MultipleSpendMaxTxOutputs as e:
self.max_button.setChecked(False)
self.show_error(str(e))
return
except NotEnoughFunds as e:
self.max_button.setChecked(False)
text = self.get_text_not_enough_funds_mentioning_frozen()
self.show_error(text)
return
self.max_button.setChecked(True)
amount = tx.output_value()
@ -1613,6 +1618,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
"""
return self.utxo_list.get_spend_list()
def get_text_not_enough_funds_mentioning_frozen(self) -> str:
text = _("Not enough funds")
frozen_bal = sum(self.wallet.get_frozen_balance())
if frozen_bal:
text += " ({} {} {})".format(
self.format_amount(frozen_bal).strip(), self.base_unit(), _("are frozen")
)
return text
def pay_onchain_dialog(
self, inputs: Sequence[PartialTxInput],
outputs: List[PartialTxOutput], *,
@ -1637,7 +1651,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
# 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'))
text = self.get_text_not_enough_funds_mentioning_frozen()
self.show_message(text)
return
# shortcut to advanced preview (after "enough funds" check!)

Loading…
Cancel
Save