asserting broke payments
This commit is contained in:
parent
abfee29676
commit
69c0cd0276
|
@ -69,8 +69,7 @@ def decode(pr: str) -> Invoice:
|
||||||
|
|
||||||
# pull out date
|
# pull out date
|
||||||
date_bin = data.read(35)
|
date_bin = data.read(35)
|
||||||
assert date_bin
|
invoice.date = date_bin.uint #type: ignore
|
||||||
invoice.date = date_bin.uint
|
|
||||||
|
|
||||||
while data.pos != data.len:
|
while data.pos != data.len:
|
||||||
tag, tagdata, data = _pull_tagged(data)
|
tag, tagdata, data = _pull_tagged(data)
|
||||||
|
@ -83,7 +82,7 @@ def decode(pr: str) -> Invoice:
|
||||||
elif tag == "p" and data_length == 52:
|
elif tag == "p" and data_length == 52:
|
||||||
invoice.payment_hash = _trim_to_bytes(tagdata).hex()
|
invoice.payment_hash = _trim_to_bytes(tagdata).hex()
|
||||||
elif tag == "x":
|
elif tag == "x":
|
||||||
invoice.expiry = tagdata.uint
|
invoice.expiry = tagdata.uint #type: ignore
|
||||||
elif tag == "n":
|
elif tag == "n":
|
||||||
invoice.payee = _trim_to_bytes(tagdata).hex()
|
invoice.payee = _trim_to_bytes(tagdata).hex()
|
||||||
# this won't work in most cases, we must extract the payee
|
# this won't work in most cases, we must extract the payee
|
||||||
|
@ -93,16 +92,11 @@ def decode(pr: str) -> Invoice:
|
||||||
elif tag == "r":
|
elif tag == "r":
|
||||||
s = bitstring.ConstBitStream(tagdata)
|
s = bitstring.ConstBitStream(tagdata)
|
||||||
while s.pos + 264 + 64 + 32 + 32 + 16 < s.len:
|
while s.pos + 264 + 64 + 32 + 32 + 16 < s.len:
|
||||||
pubkey = s.read(264)
|
pubkey = s.read(264) #type: ignore
|
||||||
assert pubkey
|
short_channel_id = s.read(64) #type: ignore
|
||||||
short_channel_id = s.read(64)
|
base_fee_msat = s.read(32) #type: ignore
|
||||||
assert short_channel_id
|
ppm_fee = s.read(32) #type: ignore
|
||||||
base_fee_msat = s.read(32)
|
cltv = s.read(16) #type: ignore
|
||||||
assert base_fee_msat
|
|
||||||
ppm_fee = s.read(32)
|
|
||||||
assert ppm_fee
|
|
||||||
cltv = s.read(16)
|
|
||||||
assert cltv
|
|
||||||
route = Route(
|
route = Route(
|
||||||
pubkey=pubkey.tobytes().hex(),
|
pubkey=pubkey.tobytes().hex(),
|
||||||
short_channel_id=_readable_scid(short_channel_id.intbe),
|
short_channel_id=_readable_scid(short_channel_id.intbe),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user