Browse Source

kivy bump fee dialog: handle no dynamic fee estimates

fix #7220
patch-4
SomberNight 4 years ago
parent
commit
4f6c0c2c61
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 11
      electrum/gui/kivy/uix/dialogs/bump_fee_dialog.py
  2. 7
      electrum/gui/kivy/uix/dialogs/dscancel_dialog.py

11
electrum/gui/kivy/uix/dialogs/bump_fee_dialog.py

@ -102,11 +102,16 @@ class BumpFeeDialog(FeeSliderDialog, Factory.Popup):
def update_text(self):
target, tooltip, dyn = self.config.get_fee_target()
self.ids.fee_target.text = target
feerate = self.config.fee_per_kb() / 1000
self.ids.new_feerate.value = f'{feerate:.1f} sat/B'
fee_per_kb = self.config.fee_per_kb()
if fee_per_kb is None:
self.ids.new_feerate.value = "unknown"
else:
fee_per_byte = fee_per_kb / 1000
self.ids.new_feerate.value = f'{fee_per_byte:.1f} sat/B'
def on_ok(self):
new_fee_rate = self.config.fee_per_kb() / 1000
fee_per_kb = self.config.fee_per_kb()
new_fee_rate = fee_per_kb / 1000 if fee_per_kb is not None else None
is_final = self.ids.final_cb.active
self.callback(new_fee_rate, is_final)

7
electrum/gui/kivy/uix/dialogs/dscancel_dialog.py

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional
from kivy.app import App
from kivy.factory import Factory
@ -95,7 +95,7 @@ class DSCancelDialog(Factory.Popup):
slider.step = 1
slider.value = pos
def get_fee_rate(self):
def get_fee_rate(self) -> Optional[int]:
pos = int(self.ids.slider.value)
if self.dynfees:
fee_rate = self.config.depth_to_fee(pos) if self.mempool else self.config.eta_to_fee(pos)
@ -104,7 +104,8 @@ class DSCancelDialog(Factory.Popup):
return fee_rate # sat/kbyte
def on_ok(self):
new_fee_rate = self.get_fee_rate() / 1000
fee_per_kb = self.get_fee_rate()
new_fee_rate = fee_per_kb / 1000 if fee_per_kb is not None else None
self.callback(new_fee_rate)
def on_slider(self, value):

Loading…
Cancel
Save