1
0

qt confirm_tx_dialog: show frozen balance if "not enough funds"

This commit is contained in:
SomberNight
2025-03-13 23:32:19 +00:00
parent 8ccd31fe49
commit 80d0d5fddd
2 changed files with 8 additions and 4 deletions

View File

@@ -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)

View File

@@ -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):