electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 13c45bd798e0017d939dd5b4dc6fd9e8651bf727
parent 4b5616ff148918d0afb1807b143853cee8718209
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed,  6 Jan 2021 03:05:13 +0100

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

fixes #6912

Diffstat:
Melectrum/gui/qt/confirm_tx_dialog.py | 7+------
Melectrum/gui/qt/main_window.py | 19+++++++++++++++++--
2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/electrum/gui/qt/confirm_tx_dialog.py b/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 diff --git a/electrum/gui/qt/main_window.py b/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!)