From 69c0cd02760a60b0f083a8f68e7f4c833b918336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 6 Feb 2023 11:44:09 +0100 Subject: [PATCH] asserting broke payments --- lnbits/bolt11.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lnbits/bolt11.py b/lnbits/bolt11.py index 628c63c58..d27f714f7 100644 --- a/lnbits/bolt11.py +++ b/lnbits/bolt11.py @@ -69,8 +69,7 @@ def decode(pr: str) -> Invoice: # pull out date date_bin = data.read(35) - assert date_bin - invoice.date = date_bin.uint + invoice.date = date_bin.uint #type: ignore while data.pos != data.len: tag, tagdata, data = _pull_tagged(data) @@ -83,7 +82,7 @@ def decode(pr: str) -> Invoice: elif tag == "p" and data_length == 52: invoice.payment_hash = _trim_to_bytes(tagdata).hex() elif tag == "x": - invoice.expiry = tagdata.uint + invoice.expiry = tagdata.uint #type: ignore elif tag == "n": invoice.payee = _trim_to_bytes(tagdata).hex() # this won't work in most cases, we must extract the payee @@ -93,16 +92,11 @@ def decode(pr: str) -> Invoice: elif tag == "r": s = bitstring.ConstBitStream(tagdata) while s.pos + 264 + 64 + 32 + 32 + 16 < s.len: - pubkey = s.read(264) - assert pubkey - short_channel_id = s.read(64) - assert short_channel_id - base_fee_msat = s.read(32) - assert base_fee_msat - ppm_fee = s.read(32) - assert ppm_fee - cltv = s.read(16) - assert cltv + pubkey = s.read(264) #type: ignore + short_channel_id = s.read(64) #type: ignore + base_fee_msat = s.read(32) #type: ignore + ppm_fee = s.read(32) #type: ignore + cltv = s.read(16) #type: ignore route = Route( pubkey=pubkey.tobytes().hex(), short_channel_id=_readable_scid(short_channel_id.intbe),