qt confirm_tx_dialog: show frozen balance if "not enough funds"
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user