fix validation rules so description_hash works.

This commit is contained in:
fiatjaf
2020-07-04 22:28:08 -03:00
parent bc27293315
commit 24dc6e5415
6 changed files with 9 additions and 17 deletions
+2 -3
View File
@@ -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