commit 08ec368baf3cd71aace0c323820e1cfa30e547e8
parent fe78ed2a8e0d09087e22d2b5803e86e013e8fdfc
Author: bitromortac <bitromortac@protonmail.com>
Date: Mon, 18 Jan 2021 08:05:29 +0100
fee-slider: fix dialog crashes for float pos values
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/electrum/gui/kivy/uix/dialogs/lightning_channels.py b/electrum/gui/kivy/uix/dialogs/lightning_channels.py
@@ -1,10 +1,9 @@
import asyncio
-from typing import TYPE_CHECKING, Optional, Tuple
+from typing import TYPE_CHECKING, Optional, Union
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.uix.popup import Popup
-from kivy.clock import Clock
from .fee_dialog import FeeDialog
from electrum.util import bh2u
@@ -13,7 +12,7 @@ from electrum.lnutil import LOCAL, REMOTE, format_short_channel_id
from electrum.lnchannel import AbstractChannel, Channel
from electrum.gui.kivy.i18n import _
from .question import Question
-from electrum.transaction import PartialTxOutput, PartialTransaction
+from electrum.transaction import PartialTxOutput
from electrum.util import NotEnoughFunds, NoDynamicFeeEstimates, format_fee_satoshis
from electrum.lnutil import ln_dummy_address
@@ -635,6 +634,7 @@ class SwapDialog(Factory.Popup):
self.send_amount: Optional[int] = None
self.receive_amount: Optional[int] = None
self.tx = None # only for forward swap
+ self.is_reverse = None
# init swaps and sliders
asyncio.run(self.swap_manager.get_pairs())
@@ -676,7 +676,7 @@ class SwapDialog(Factory.Popup):
self.ids.fee_rate.text = f'{fee_per_b} sat/B'
self.ids.fee_estimate.text = msg
- def update_tx(self, onchain_amount: int):
+ def update_tx(self, onchain_amount: Union[int, str]):
"""Updates the transaction associated with a forward swap."""
if onchain_amount is None:
self.tx = None
@@ -688,7 +688,7 @@ class SwapDialog(Factory.Popup):
self.tx = self.app.wallet.make_unsigned_transaction(
coins=coins,
outputs=outputs)
- except (NotEnoughFunds, NoDynamicFeeEstimates) as e:
+ except (NotEnoughFunds, NoDynamicFeeEstimates):
self.tx = None
self.ids.ok_button.disabled = True
diff --git a/electrum/simple_config.py b/electrum/simple_config.py
@@ -325,7 +325,7 @@ class SimpleConfig(Logger):
slider_pos = max(slider_pos, 0)
slider_pos = min(slider_pos, len(FEE_ETA_TARGETS))
if slider_pos < len(FEE_ETA_TARGETS):
- num_blocks = FEE_ETA_TARGETS[slider_pos]
+ num_blocks = FEE_ETA_TARGETS[int(slider_pos)]
fee = self.eta_target_to_fee(num_blocks)
else:
fee = self.eta_target_to_fee(1)