URI: 
       tqt tx dialog: small fee edit fix - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 66ddedb97ea2eef37cb9355de35e5ad534013373
   DIR parent 8bd27851a47707e2c4a039c7675f01e66fbfb939
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Tue, 19 Nov 2019 19:29:10 +0100
       
       qt tx dialog: small fee edit fix
       
       scenario: enter extremely high feerate (which we cannot satisfy) then click into fee_edit.
       At that moment, fee_edit is empty and both feerate_edit and fee_edit are considered frozen.
       As fee_edit has priority, we would construct a tx with default fee.
       Now, instead, we won't construct this default fee tx ~as if the click to fee_edit did not happen.
       
       Diffstat:
         M electrum/gui/qt/amountedit.py       |       3 ++-
         M electrum/gui/qt/transaction_dialog… |       4 ++--
         M electrum/util.py                    |       2 +-
       
       3 files changed, 5 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/electrum/gui/qt/amountedit.py b/electrum/gui/qt/amountedit.py
       t@@ -1,6 +1,7 @@
        # -*- coding: utf-8 -*-
        
        from decimal import Decimal
       +from typing import Union
        
        from PyQt5.QtCore import pyqtSignal, Qt
        from PyQt5.QtGui import QPalette, QPainter
       t@@ -71,7 +72,7 @@ class AmountEdit(MyLineEdit):
                    painter.setPen(self.help_palette.brush(QPalette.Disabled, QPalette.Text).color())
                    painter.drawText(textRect, Qt.AlignRight | Qt.AlignVCenter, self.base_unit())
        
       -    def get_amount(self):
       +    def get_amount(self) -> Union[None, Decimal, int]:
                try:
                    return (int if self.is_int else Decimal)(str(self.text()))
                except:
   DIR diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py
       t@@ -693,9 +693,9 @@ class PreviewTxDialog(BaseTxDialog, TxEditor):
                                         .format(num_satoshis_added))
        
            def get_fee_estimator(self):
       -        if self.is_send_fee_frozen():
       +        if self.is_send_fee_frozen() and self.fee_e.get_amount() is not None:
                    fee_estimator = self.fee_e.get_amount()
       -        elif self.is_send_feerate_frozen():
       +        elif self.is_send_feerate_frozen() and self.feerate_e.get_amount() is not None:
                    amount = self.feerate_e.get_amount()  # sat/byte feerate
                    amount = 0 if amount is None else amount * 1000  # sat/kilobyte feerate
                    fee_estimator = partial(
   DIR diff --git a/electrum/util.py b/electrum/util.py
       t@@ -642,7 +642,7 @@ def format_fee_satoshis(fee, *, num_zeros=0, precision=None):
            return format_satoshis(fee, num_zeros=num_zeros, decimal_point=0, precision=precision)
        
        
       -def quantize_feerate(fee):
       +def quantize_feerate(fee) -> Union[None, Decimal, int]:
            """Strip sat/byte fee rate of excess precision."""
            if fee is None:
                return None