traise PaymentFailure in case of timeout (follow-up previous commit) - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 50479086b5b6c0bd3ebe9e597bcd37fbb6d97372 DIR parent dbe8b756595778ed5fb1ee251ac24e28b02e5e1e HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 30 May 2019 21:46:30 +0200 raise PaymentFailure in case of timeout (follow-up previous commit) Diffstat: M electrum/gui/qt/main_window.py | 1 - M electrum/lnworker.py | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py t@@ -1687,7 +1687,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): elif isinstance(e, InvoiceError): self.show_error(_('InvoiceError: {}').format(e)) else: - self.show_error(_('Error: {}').format(e)) raise e def task(): success = self.wallet.lnworker.pay(invoice, attempts=LN_NUM_PAYMENT_ATTEMPTS, amount_sat=amount, timeout=30) DIR diff --git a/electrum/lnworker.py b/electrum/lnworker.py t@@ -14,6 +14,7 @@ import json from datetime import datetime, timezone from functools import partial from collections import defaultdict +import concurrent import dns.resolver import dns.exception t@@ -660,7 +661,11 @@ class LNWallet(LNWorker): fut = asyncio.run_coroutine_threadsafe( self._pay(invoice, attempts, amount_sat), self.network.asyncio_loop) - return fut.result(timeout=timeout) + try: + return fut.result(timeout=timeout) + except concurrent.futures.TimeoutError: + raise PaymentFailure(_("Payment timed out")) + def get_channel_by_short_id(self, short_channel_id): with self.lock: