Use attr.s classes for invoices and requests:
- storage upgrade - fixes #6192 - add can_pay_invoice, can_receive_invoice to lnworker
This commit is contained in:
@@ -13,7 +13,6 @@ from .bitcoin import hash160_to_b58_address, b58_address_to_hash160
|
||||
from .segwit_addr import bech32_encode, bech32_decode, CHARSET
|
||||
from . import constants
|
||||
from . import ecc
|
||||
from .util import PR_TYPE_LN
|
||||
from .bitcoin import COIN
|
||||
|
||||
|
||||
@@ -470,20 +469,6 @@ def lndecode(invoice: str, *, verbose=False, expected_hrp=None) -> LnAddr:
|
||||
|
||||
|
||||
|
||||
def parse_lightning_invoice(invoice):
|
||||
lnaddr = lndecode(invoice, expected_hrp=constants.net.SEGWIT_HRP)
|
||||
amount = int(lnaddr.amount * COIN) if lnaddr.amount else None
|
||||
return {
|
||||
'type': PR_TYPE_LN,
|
||||
'invoice': invoice,
|
||||
'amount': amount,
|
||||
'message': lnaddr.get_description(),
|
||||
'time': lnaddr.date,
|
||||
'exp': lnaddr.get_expiry(),
|
||||
'pubkey': lnaddr.pubkey.serialize().hex(),
|
||||
'rhash': lnaddr.paymenthash.hex(),
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
# run using
|
||||
# python3 -m electrum.lnaddr <invoice> <expected hrp>
|
||||
|
||||
Reference in New Issue
Block a user