invoices/lnaddr: LNInvoice.from_bech32 now raises InvoiceError
rm LnAddressError fixes https://github.com/spesmilo/electrum/issues/7321 related https://github.com/spesmilo/electrum/pull/7234
This commit is contained in:
@@ -212,7 +212,14 @@ class LNInvoice(Invoice):
|
||||
|
||||
@classmethod
|
||||
def from_bech32(cls, invoice: str) -> 'LNInvoice':
|
||||
amount_msat = lndecode(invoice).get_amount_msat()
|
||||
"""Constructs LNInvoice object from BOLT-11 string.
|
||||
Might raise InvoiceError.
|
||||
"""
|
||||
try:
|
||||
lnaddr = lndecode(invoice)
|
||||
except Exception as e:
|
||||
raise InvoiceError(e) from e
|
||||
amount_msat = lnaddr.get_amount_msat()
|
||||
return LNInvoice(
|
||||
type=PR_TYPE_LN,
|
||||
invoice=invoice,
|
||||
|
||||
Reference in New Issue
Block a user