wallet.export_invoice: should support onchain invoice with "!" (max) amount
As the GUI allows saving such invoices, CLI should not break for these wallets.
Also note the pre-existing assert on the next line.
follow-up bf4455ef30
```
>>> list_invoices()
Traceback (most recent call last):
File "...\electrum\gui\qt\main_window.py", line 1506, in <lambda>
return lambda *args, **kwargs: f(method,
File "...\electrum\commands.py", line 191, in _run
result = fut.result()
File "...\Python310\lib\concurrent\futures\_base.py", line 446, in result
return self.__get_result()
File "...\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
raise self._exception
File "...\electrum\commands.py", line 154, in func_wrapper
return await func(*args, **kwargs)
File "...\electrum\commands.py", line 1188, in list_invoices
return [wallet.export_invoice(x) for x in l]
File "...\electrum\commands.py", line 1188, in <listcomp>
return [wallet.export_invoice(x) for x in l]
File "...\electrum\wallet.py", line 2405, in export_invoice
amount_sat = int(x.get_amount_sat())
ValueError: invalid literal for int() with base 10: '!'
```
This commit is contained in:
@@ -2402,7 +2402,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
||||
if self.lnworker and status == PR_UNPAID:
|
||||
d['can_pay'] = self.lnworker.can_pay_invoice(x)
|
||||
else:
|
||||
amount_sat = int(x.get_amount_sat())
|
||||
amount_sat = x.get_amount_sat()
|
||||
assert isinstance(amount_sat, (int, str, type(None)))
|
||||
d['amount_sat'] = amount_sat
|
||||
d['outputs'] = [y.to_legacy_tuple() for y in x.get_outputs()]
|
||||
|
||||
Reference in New Issue
Block a user