SomberNight
4 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
9 additions and
4 deletions
-
electrum/gui/kivy/uix/dialogs/lightning_channels.py
-
electrum/simple_config.py
|
|
@ -680,12 +680,12 @@ class SwapDialog(Factory.Popup): |
|
|
|
|
|
|
|
def update_fee_text(self): |
|
|
|
fee_per_kb = self.config.fee_per_kb() |
|
|
|
fee_per_b = format_fee_satoshis(fee_per_kb / 1000) if fee_per_kb is not None else "unknown" |
|
|
|
# eta is -1 when block inclusion cannot be estimated for low fees |
|
|
|
eta = self.config.fee_to_eta(fee_per_kb) |
|
|
|
|
|
|
|
fee_per_b = format_fee_satoshis(fee_per_kb / 1000) |
|
|
|
suggest_fee = self.config.eta_target_to_fee(RECOMMEND_BLOCKS_SWAP) |
|
|
|
suggest_fee_per_b = format_fee_satoshis(suggest_fee / 1000) |
|
|
|
suggest_fee_per_b = format_fee_satoshis(suggest_fee / 1000) if suggest_fee is not None else "unknown" |
|
|
|
|
|
|
|
s = 's' if eta > 1 else '' |
|
|
|
if eta > RECOMMEND_BLOCKS_SWAP or eta == -1: |
|
|
|
|
|
@ -405,12 +405,17 @@ class SimpleConfig(Logger): |
|
|
|
return 1 |
|
|
|
return FEE_ETA_TARGETS[slider_pos] |
|
|
|
|
|
|
|
def fee_to_eta(self, fee_per_kb: int) -> int: |
|
|
|
def fee_to_eta(self, fee_per_kb: Optional[int]) -> int: |
|
|
|
"""Returns 'num blocks' ETA estimate for given fee rate, |
|
|
|
or -1 for low fee. |
|
|
|
""" |
|
|
|
import operator |
|
|
|
lst = list(self.fee_estimates.items()) + [(1, self.eta_to_fee(len(FEE_ETA_TARGETS)))] |
|
|
|
lst = list(self.fee_estimates.items()) |
|
|
|
next_block_fee = self.eta_target_to_fee(1) |
|
|
|
if next_block_fee is not None: |
|
|
|
lst += [(1, next_block_fee)] |
|
|
|
if not lst or fee_per_kb is None: |
|
|
|
return -1 |
|
|
|
dist = map(lambda x: (x[0], abs(x[1] - fee_per_kb)), lst) |
|
|
|
min_target, min_value = min(dist, key=operator.itemgetter(1)) |
|
|
|
if fee_per_kb < self.fee_estimates.get(FEE_ETA_TARGETS[0])/2: |
|
|
|