qt send tab: mention frozen balance if "not enough funds" in more cases
fixes #6912
This commit is contained in:
@@ -229,12 +229,7 @@ class ConfirmTxDialog(TxEditor, WindowModalDialog):
|
|||||||
self._update_amount_label()
|
self._update_amount_label()
|
||||||
|
|
||||||
if self.not_enough_funds:
|
if self.not_enough_funds:
|
||||||
text = _("Not enough funds")
|
text = self.main_window.get_text_not_enough_funds_mentioning_frozen()
|
||||||
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")
|
|
||||||
)
|
|
||||||
self.toggle_send_button(False, message=text)
|
self.toggle_send_button(False, message=text)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1411,10 +1411,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
# Check if we had enough funds excluding fees,
|
# Check if we had enough funds excluding fees,
|
||||||
# if so, still provide opportunity to set lower fees.
|
# if so, still provide opportunity to set lower fees.
|
||||||
tx = make_tx(0)
|
tx = make_tx(0)
|
||||||
except (MultipleSpendMaxTxOutputs, NotEnoughFunds) as e:
|
except MultipleSpendMaxTxOutputs as e:
|
||||||
self.max_button.setChecked(False)
|
self.max_button.setChecked(False)
|
||||||
self.show_error(str(e))
|
self.show_error(str(e))
|
||||||
return
|
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)
|
self.max_button.setChecked(True)
|
||||||
amount = tx.output_value()
|
amount = tx.output_value()
|
||||||
@@ -1613,6 +1618,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
"""
|
"""
|
||||||
return self.utxo_list.get_spend_list()
|
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(
|
def pay_onchain_dialog(
|
||||||
self, inputs: Sequence[PartialTxInput],
|
self, inputs: Sequence[PartialTxInput],
|
||||||
outputs: List[PartialTxOutput], *,
|
outputs: List[PartialTxOutput], *,
|
||||||
@@ -1637,7 +1651,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
# Check if we had enough funds excluding fees,
|
# Check if we had enough funds excluding fees,
|
||||||
# if so, still provide opportunity to set lower fees.
|
# if so, still provide opportunity to set lower fees.
|
||||||
if not d.have_enough_funds_assuming_zero_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
|
return
|
||||||
|
|
||||||
# shortcut to advanced preview (after "enough funds" check!)
|
# shortcut to advanced preview (after "enough funds" check!)
|
||||||
|
|||||||
Reference in New Issue
Block a user