diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index 277b17f7d..2ec4de174 100644 --- a/electrum/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -14,7 +14,7 @@ from electrum.wallet import Wallet, InternalAddressCorruption from electrum.paymentrequest import InvoiceStore from electrum.util import profiler, InvalidPassword, send_exception_to_crash_reporter from electrum.plugin import run_hook -from electrum.util import format_satoshis, format_satoshis_plain +from electrum.util import format_satoshis, format_satoshis_plain, format_fee_satoshis from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED from electrum import blockchain from electrum.network import Network, TxBroadcastError, BestEffortRequestFailed @@ -808,6 +808,10 @@ class ElectrumWindow(App): def format_amount_and_units(self, x): return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit + def format_fee_rate(self, fee_rate): + # fee_rate is in sat/kB + return format_fee_satoshis(fee_rate/1000) + ' sat/byte' + #@profiler def update_wallet(self, *dt): self._trigger_update_status() diff --git a/electrum/gui/kivy/uix/dialogs/tx_dialog.py b/electrum/gui/kivy/uix/dialogs/tx_dialog.py index d018e5a77..f62f926dd 100644 --- a/electrum/gui/kivy/uix/dialogs/tx_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/tx_dialog.py @@ -27,6 +27,7 @@ Builder.load_string(''' can_broadcast: False can_rbf: False fee_str: '' + feerate_str: '' date_str: '' date_label:'' amount_str: '' @@ -65,6 +66,9 @@ Builder.load_string(''' BoxLabel: text: _('Transaction fee') if root.fee_str else '' value: root.fee_str + BoxLabel: + text: _('Transaction fee rate') if root.feerate_str else '' + value: root.feerate_str TopLabel: text: _('Transaction ID') + ':' if root.tx_hash else '' TxHashLabel: @@ -148,7 +152,13 @@ class TxDialog(Factory.Popup): else: self.is_mine = True self.amount_str = format_amount(-amount) - self.fee_str = format_amount(fee) if fee is not None else _('unknown') + if fee is not None: + self.fee_str = format_amount(fee) + fee_per_kb = fee / self.tx.estimated_size() * 1000 + self.feerate_str = self.app.format_fee_rate(fee_per_kb) + else: + self.fee_str = _('unknown') + self.feerate_str = _('unknown') self.can_sign = self.wallet.can_sign(self.tx) self.ids.output_list.update(self.tx.get_outputs_for_UI()) self.is_local_tx = tx_mined_status.height == TX_HEIGHT_LOCAL