From cc18f667930c8de094f12756a11659a43aa311d5 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 9 Oct 2018 12:03:38 +0200 Subject: [PATCH] network: don't save negative ETA fee estimates -1 means bitcoind could not give an estimate --- electrum/gui/qt/main_window.py | 4 ++-- electrum/network.py | 3 ++- electrum/util.py | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 2659a726e..68f3a4bd9 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1542,8 +1542,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): tx = self.wallet.make_unsigned_transaction( coins, outputs, self.config, fixed_fee=fee_estimator, is_sweep=is_sweep) - except NotEnoughFunds: - self.show_message(_("Insufficient funds")) + except (NotEnoughFunds, NoDynamicFeeEstimates) as e: + self.show_message(str(e)) return except BaseException as e: traceback.print_exc(file=sys.stdout) diff --git a/electrum/network.py b/electrum/network.py index 5eb7db4c9..cc81259f2 100644 --- a/electrum/network.py +++ b/electrum/network.py @@ -357,8 +357,9 @@ class Network(PrintError): self.notify('fee_histogram') for i, task in fee_tasks: fee = int(task.result() * COIN) - self.config.update_fee_estimates(i, fee) self.print_error("fee_estimates[%d]" % i, fee) + if fee < 0: continue + self.config.update_fee_estimates(i, fee) self.notify('fee') def get_status_value(self, key): diff --git a/electrum/util.py b/electrum/util.py index 759fb740e..9384065bf 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -77,7 +77,9 @@ def base_unit_name_to_decimal_point(unit_name: str) -> int: raise UnknownBaseUnit(unit_name) from None -class NotEnoughFunds(Exception): pass +class NotEnoughFunds(Exception): + def __str__(self): + return _("Insufficient funds") class NoDynamicFeeEstimates(Exception):