electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 3bf5afa61a8be467ecfb4a4fad22d8e678302126
parent 426ab85ed65abd63d546666b28bdf6d28325b4f7
Author: SomberNight <somber.night@protonmail.com>
Date:   Thu, 12 Apr 2018 12:17:24 +0200

fix #4253

Diffstat:
Mgui/kivy/uix/dialogs/bump_fee_dialog.py | 6+-----
Mgui/kivy/uix/dialogs/fee_dialog.py | 1-
Mlib/simple_config.py | 14++++++++++----
3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gui/kivy/uix/dialogs/bump_fee_dialog.py b/gui/kivy/uix/dialogs/bump_fee_dialog.py @@ -76,7 +76,7 @@ class BumpFeeDialog(Factory.Popup): self.callback = callback self.config = app.electrum_config self.mempool = self.config.use_mempool_fees() - self.dynfees = self.config.is_dynfee() and self.app.network and self.config.has_dynamic_fees_ready() + self.dynfees = self.config.is_dynfee() and bool(self.app.network) and self.config.has_dynamic_fees_ready() self.ids.old_fee.value = self.app.format_amount_and_units(self.init_fee) self.update_slider() self.update_text() @@ -116,7 +116,3 @@ class BumpFeeDialog(Factory.Popup): def on_slider(self, value): self.update_text() - - def on_checkbox(self, b): - self.dynfees = b - self.update_text() diff --git a/gui/kivy/uix/dialogs/fee_dialog.py b/gui/kivy/uix/dialogs/fee_dialog.py @@ -74,7 +74,6 @@ class FeeDialog(Factory.Popup): Factory.Popup.__init__(self) self.app = app self.config = config - self.fee_rate = self.config.fee_per_kb() self.callback = callback mempool = self.config.use_mempool_fees() dynfees = self.config.is_dynfee() diff --git a/lib/simple_config.py b/lib/simple_config.py @@ -407,7 +407,7 @@ class SimpleConfig(PrintError): maxp = len(FEE_ETA_TARGETS) # not (-1) to have "next block" fee_rate = self.eta_to_fee(pos) else: - fee_rate = self.fee_per_kb() + fee_rate = self.fee_per_kb(dyn=False) pos = self.static_fee_index(fee_rate) maxp = 9 return maxp, pos, fee_rate @@ -416,6 +416,8 @@ class SimpleConfig(PrintError): return FEERATE_STATIC_VALUES[i] def static_fee_index(self, value): + if value is None: + raise TypeError('static fee cannot be None') dist = list(map(lambda x: abs(x - value), FEERATE_STATIC_VALUES)) return min(range(len(dist)), key=dist.__getitem__) @@ -437,12 +439,16 @@ class SimpleConfig(PrintError): def use_mempool_fees(self): return bool(self.get('mempool_fees', False)) - def fee_per_kb(self): + def fee_per_kb(self, dyn=None, mempool=None): """Returns sat/kvB fee to pay for a txn. Note: might return None. """ - if self.is_dynfee(): - if self.use_mempool_fees(): + if dyn is None: + dyn = self.is_dynfee() + if mempool is None: + mempool = self.use_mempool_fees() + if dyn: + if mempool: fee_rate = self.depth_to_fee(self.get_depth_level()) else: fee_rate = self.eta_to_fee(self.get_fee_level())