From 80d0d5fddd72920b81bfc050bf6b0f0506711975 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 13 Mar 2025 23:32:19 +0000 Subject: [PATCH] qt confirm_tx_dialog: show frozen balance if "not enough funds" --- electrum/gui/qt/confirm_tx_dialog.py | 10 +++++++--- electrum/gui/qt/main_window.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qt/confirm_tx_dialog.py b/electrum/gui/qt/confirm_tx_dialog.py index 970aa7cc2..e14629699 100644 --- a/electrum/gui/qt/confirm_tx_dialog.py +++ b/electrum/gui/qt/confirm_tx_dialog.py @@ -535,8 +535,9 @@ class TxEditor(WindowModalDialog): self.error += ' ' + _('Change your settings to allow spending unconfirmed coins.') elif self.can_pay_assuming_zero_fees(confirmed_only=confirmed_only): self.error += ' ' + _('You need to set a lower fee.') - else: - self.error += '' + elif frozen_bal := self.wallet.get_frozen_balance_str(): + # FIXME only show if unfreezing would fix "not enough funds" + self.error += ' ' + _("Some coins are frozen: {} (can be unfrozen in the Addresses or in the Coins tab)").format(frozen_bal) if not self.tx: if self.not_enough_funds: self.io_widget.update(None) @@ -616,6 +617,9 @@ class TxEditor(WindowModalDialog): self.preview_button.setEnabled(enabled) self.ok_button.setEnabled(enabled) + def can_pay_assuming_zero_fees(self, confirmed_only: bool) -> bool: + raise NotImplementedError + class ConfirmTxDialog(TxEditor): help_text = '' #_('Set the mining fee of your transaction') @@ -681,7 +685,7 @@ class ConfirmTxDialog(TxEditor): raise self.tx.set_rbf(True) - def can_pay_assuming_zero_fees(self, confirmed_only) -> bool: + def can_pay_assuming_zero_fees(self, confirmed_only: bool) -> bool: # called in send_tab.py try: tx = self.make_tx(FixedFeePolicy(0), confirmed_only=confirmed_only, base_tx=None) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 4ce831971..d432a6fda 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1418,7 +1418,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): def confirm_tx_dialog(self, make_tx, output_value, allow_preview=True, batching_candidates=None): d = ConfirmTxDialog(window=self, make_tx=make_tx, output_value=output_value, allow_preview=allow_preview, batching_candidates=batching_candidates) - if d.not_enough_funds: + if d.not_enough_funds: # FIXME this check looks broken? # note: use confirmed_only=False here, regardless of config setting, # as the user needs to get to ConfirmTxDialog to change the config setting if not d.can_pay_assuming_zero_fees(confirmed_only=False):