fix validation rules so description_hash works.
This commit is contained in:
+2
-3
@@ -2,7 +2,6 @@
|
||||
|
||||
import bitstring
|
||||
import re
|
||||
from binascii import hexlify
|
||||
from bech32 import bech32_decode, CHARSET
|
||||
|
||||
|
||||
@@ -51,9 +50,9 @@ def decode(pr: str) -> Invoice:
|
||||
if tag == "d":
|
||||
invoice.description = trim_to_bytes(tagdata).decode("utf-8")
|
||||
elif tag == "h" and data_length == 52:
|
||||
invoice.description = hexlify(trim_to_bytes(tagdata)).decode("ascii")
|
||||
invoice.description = trim_to_bytes(tagdata).hex()
|
||||
elif tag == "p" and data_length == 52:
|
||||
invoice.payment_hash = hexlify(trim_to_bytes(tagdata)).decode("ascii")
|
||||
invoice.payment_hash = trim_to_bytes(tagdata).hex()
|
||||
|
||||
return invoice
|
||||
|
||||
|
||||
Reference in New Issue
Block a user