From d3f65e24e143121e6209547d49463171af01b1a0 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 17 May 2019 20:10:10 +0200 Subject: [PATCH] kivy: warn user during "Send" if high fee (change condition) Specifically, warning was previously triggered if fee > 1 mBTC; now it is unified with Qt, warning is triggered if feerate > 600 sat/byte. --- electrum/gui/kivy/uix/screens.py | 6 ++++-- electrum/gui/qt/main_window.py | 4 ++-- electrum/gui/qt/transaction_dialog.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py index 3fdc682db..613a40f78 100644 --- a/electrum/gui/kivy/uix/screens.py +++ b/electrum/gui/kivy/uix/screens.py @@ -25,6 +25,7 @@ from electrum.util import send_exception_to_crash_reporter from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED from electrum.plugin import run_hook from electrum.wallet import InternalAddressCorruption +from electrum import simple_config from .context_menu import ContextMenu @@ -293,8 +294,9 @@ class SendScreen(CScreen): x_fee_address, x_fee_amount = x_fee msg.append(_("Additional fees") + ": " + self.app.format_amount_and_units(x_fee_amount)) - if fee >= config.get('confirm_fee', 100000): - msg.append(_('Warning')+ ': ' + _("The fee for this transaction seems unusually high.")) + feerate_warning = simple_config.FEERATE_WARNING_HIGH_FEE + if fee > feerate_warning * tx.estimated_size() / 1000: + msg.append(_('Warning') + ': ' + _("The fee for this transaction seems unusually high.")) msg.append(_("Enter your PIN code to proceed")) self.app.protected('\n'.join(msg), self.send_tx, (tx, message)) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 029231e71..7022fa684 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1683,8 +1683,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): x_fee_address, x_fee_amount = x_fee msg.append( _("Additional fees") + ": " + self.format_amount_and_units(x_fee_amount) ) - confirm_rate = simple_config.FEERATE_WARNING_HIGH_FEE - if fee > confirm_rate * tx.estimated_size() / 1000: + feerate_warning = simple_config.FEERATE_WARNING_HIGH_FEE + if fee > feerate_warning * tx.estimated_size() / 1000: msg.append(_('Warning') + ': ' + _("The fee for this transaction seems unusually high.")) if self.wallet.has_keystore_encryption(): diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py index c84c99e78..034554754 100644 --- a/electrum/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -273,8 +273,8 @@ class TxDialog(QDialog, MessageBoxMixin): if fee is not None: fee_rate = fee/size*1000 fee_str += ' ( %s ) ' % self.main_window.format_fee_rate(fee_rate) - confirm_rate = simple_config.FEERATE_WARNING_HIGH_FEE - if fee_rate > confirm_rate: + feerate_warning = simple_config.FEERATE_WARNING_HIGH_FEE + if fee_rate > feerate_warning: fee_str += ' - ' + _('Warning') + ': ' + _("high fee") + '!' self.amount_label.setText(amount_str) self.fee_label.setText(fee_str)