commit a74552f3dd21317133cf4802aa255f80a636b870
parent a98fd14f8d9b9c1d17fd6c25d58cc4b72a6fd8b4
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 18 Jun 2020 20:43:34 +0200
qt main_window: fix threading for run_coroutine_from_thread
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
@@ -158,6 +158,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
alias_received_signal = pyqtSignal()
computing_privkeys_signal = pyqtSignal()
show_privkeys_signal = pyqtSignal()
+ show_error_signal = pyqtSignal(str)
def __init__(self, gui_object: 'ElectrumGui', wallet: Abstract_Wallet):
QMainWindow.__init__(self)
@@ -250,6 +251,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.payment_request_ok_signal.connect(self.payment_request_ok)
self.payment_request_error_signal.connect(self.payment_request_error)
+ self.show_error_signal.connect(self.show_error)
self.history_list.setFocus(True)
# network callbacks
@@ -307,7 +309,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
if on_result:
on_result(r)
except Exception as e:
- self.show_error(str(e))
+ self.logger.exception("exception in coro scheduled via window.wallet")
+ self.show_error_signal.emit(str(e))
self.wallet.thread.add(task)
def on_fx_history(self):
diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py
@@ -183,7 +183,6 @@ class SwapManager(Logger):
callback = lambda: self._claim_swap(swap)
self.lnwatcher.add_callback(swap.lockup_address, callback)
- @log_exceptions
async def normal_swap(self, lightning_amount: int, expected_onchain_amount: int,
password, *, tx: PartialTransaction = None) -> str:
"""send on-chain BTC, receive on Lightning"""
@@ -264,7 +263,6 @@ class SwapManager(Logger):
await self.network.broadcast_transaction(tx)
return tx.txid()
- @log_exceptions
async def reverse_swap(self, amount_sat: int, expected_amount: int) -> bool:
"""send on Lightning, receive on-chain"""
privkey = os.urandom(32)
@@ -354,7 +352,6 @@ class SwapManager(Logger):
success, log = await self.lnworker._pay(invoice, attempts=10)
return success
- @log_exceptions
async def get_pairs(self) -> None:
response = await self.network._send_http_on_proxy(
'get',