Browse Source

qt ConfirmTxDialog: (fix) allow sending tx with high feerate

master
SomberNight 5 years ago
parent
commit
1ac41b33a2
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 29
      electrum/gui/qt/confirm_tx_dialog.py

29
electrum/gui/qt/confirm_tx_dialog.py

@ -191,17 +191,15 @@ class ConfirmTxDialog(TxEditor, WindowModalDialog):
self.is_send = True self.is_send = True
self.accept() self.accept()
def disable(self, reason): def toggle_send_button(self, enable: bool, *, message: str = None):
self.message_label.setStyleSheet(ColorScheme.RED.as_stylesheet()) if message is None:
self.message_label.setText(reason) self.message_label.setStyleSheet(None)
self.pw.setEnabled(False) self.message_label.setText(self.default_message())
self.send_button.setEnabled(False) else:
self.message_label.setStyleSheet(ColorScheme.RED.as_stylesheet())
def enable(self): self.message_label.setText(message)
self.message_label.setStyleSheet(None) self.pw.setEnabled(enable)
self.message_label.setText(self.default_message()) self.send_button.setEnabled(enable)
self.pw.setEnabled(True)
self.send_button.setEnabled(True)
def _update_amount_label(self): def _update_amount_label(self):
tx = self.tx tx = self.tx
@ -227,7 +225,7 @@ class ConfirmTxDialog(TxEditor, WindowModalDialog):
text += " ({} {} {})".format( text += " ({} {} {})".format(
self.main_window.format_amount(c + u + x).strip(), self.main_window.base_unit(), _("are frozen") self.main_window.format_amount(c + u + x).strip(), self.main_window.base_unit(), _("are frozen")
) )
self.disable(text) self.toggle_send_button(False, message=text)
return return
if not tx: if not tx:
@ -250,8 +248,9 @@ class ConfirmTxDialog(TxEditor, WindowModalDialog):
_("This transaction requires a higher fee, or it will not be propagated by your current server"), _("This transaction requires a higher fee, or it will not be propagated by your current server"),
_("Try to raise your transaction fee, or use a server with a lower relay fee.") _("Try to raise your transaction fee, or use a server with a lower relay fee.")
]) ])
self.disable(msg) self.toggle_send_button(False, message=msg)
elif high_fee: elif high_fee:
self.disable(_('Warning') + ': ' + _("The fee for this transaction seems unusually high.")) self.toggle_send_button(True,
message=_('Warning') + ': ' + _("The fee for this transaction seems unusually high."))
else: else:
self.enable() self.toggle_send_button(True)

Loading…
Cancel
Save