From e84679982e06fdcbb21bd694761656162b222be5 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 16 Oct 2024 12:42:58 +0000 Subject: [PATCH] qt tx dlg: fix showing fee warnings In qt, only the confirm_tx_dialog was showing the fee warnings, the transaction_dialog was not... regression from https://github.com/spesmilo/electrum/commit/bc3946d2f4e00abdfc8bcd2980ea4a467a2e9756 --- electrum/gui/qt/transaction_dialog.py | 2 +- electrum/wallet.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py index 1c05185c8..bf0ef39d8 100644 --- a/electrum/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -905,7 +905,7 @@ class TxDialog(QDialog, MessageBoxMixin): fee_rate = Decimal(fee) / size # sat/byte fee_str += ' ( %s ) ' % self.main_window.format_fee_rate(fee_rate * 1000) if isinstance(self.tx, PartialTransaction): - invoice_amt = amount + invoice_amt = abs(amount) fee_warning_tuple = self.wallet.get_tx_fee_warning( invoice_amt=invoice_amt, tx_size=size, fee=fee) if fee_warning_tuple: diff --git a/electrum/wallet.py b/electrum/wallet.py index 8f24fbf43..ed146b7b2 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -3178,6 +3178,8 @@ class Abstract_Wallet(ABC, Logger, EventListener): tx_size: int, fee: int) -> Optional[Tuple[bool, str, str]]: + assert invoice_amt >= 0, f"{invoice_amt=!r} must be non-negative satoshis" + assert fee >= 0, f"{fee=!r} must be non-negative satoshis" feerate = Decimal(fee) / tx_size # sat/byte fee_ratio = Decimal(fee) / invoice_amt if invoice_amt else 0 long_warning = None