From 0e4b3a3d5835d2201e5803f15a918f61abd5adbe Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sat, 28 Jun 2025 10:02:40 +0000 Subject: [PATCH] commands: add comment about "timeout" args really is black magic --- electrum/commands.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electrum/commands.py b/electrum/commands.py index 01af4aea6..190b3b220 100644 --- a/electrum/commands.py +++ b/electrum/commands.py @@ -1701,10 +1701,18 @@ class Commands(Logger): async def lnpay(self, invoice, timeout=120, password=None, wallet: Abstract_Wallet = None): """ Pay a lightning invoice + Note: it is *not* safe to try paying the same invoice multiple times with a timeout. + It is only safe to retry paying the same invoice if there are no more pending HTLCs + with the same payment_hash. # FIXME should there even be a default timeout? just block forever. arg:str:invoice:Lightning invoice (bolt 11) - arg:int:timeout:Timeout in seconds (default=20) + arg:int:timeout:Timeout in seconds (default=120) """ + # note: The "timeout" param works via black magic. + # The CLI-parser stores it in the config, and the argname matches config.cv.CLI_TIMEOUT.key(). + # - it works when calling the CLI and there is also a daemon (online command) + # - FIXME it does NOT work when calling an offline command (-o) + # - FIXME it does NOT work when calling RPC directly (e.g. curl) lnworker = wallet.lnworker lnaddr = lnworker._check_bolt11_invoice(invoice) payment_hash = lnaddr.paymenthash