mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
raise PaymentFailure in case of timeout (follow-up previous commit)
This commit is contained in:
parent
dbe8b75659
commit
50479086b5
2 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue