mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-21 22:14:57 +02:00
Lnurlp: use unhashed_description
instead of description_hash
(#878)
* dont assume field * pass unhashed_description instead of description_hash for LNURL stuff * more
This commit is contained in:
parent
3df66334db
commit
0f760bf39e
@ -73,7 +73,7 @@ async def lnurl_callback(
|
||||
wallet_id=cp.wallet,
|
||||
amount=int(amount_received / 1000),
|
||||
memo=cp.lnurl_title,
|
||||
description_hash=(
|
||||
unhashed_description=(
|
||||
LnurlPayMetadata(json.dumps([["text/plain", str(cp.lnurl_title)]]))
|
||||
).encode("utf-8"),
|
||||
extra={"tag": "copilot", "copilotid": cp.id, "comment": comment},
|
||||
|
@ -90,7 +90,7 @@ async def lnurl_callback(
|
||||
wallet_id=ls.wallet,
|
||||
amount=int(amount_received / 1000),
|
||||
memo=await track.fullname(),
|
||||
description_hash=(await track.lnurlpay_metadata()).encode("utf-8"),
|
||||
unhashed_description=(await track.lnurlpay_metadata()).encode("utf-8"),
|
||||
extra={"tag": "livestream", "track": track.id, "comment": comment},
|
||||
)
|
||||
|
||||
|
@ -205,7 +205,7 @@ async def lnurl_callback(
|
||||
wallet_id=device.wallet,
|
||||
amount=lnurldevicepayment.sats / 1000,
|
||||
memo=device.title,
|
||||
description_hash=(await device.lnurlpay_metadata()).encode("utf-8"),
|
||||
unhashed_description=(await device.lnurlpay_metadata()).encode("utf-8"),
|
||||
extra={"tag": "PoS"},
|
||||
)
|
||||
lnurldevicepayment = await update_lnurldevicepayment(
|
||||
|
@ -87,7 +87,7 @@ async def api_lnurl_callback(request: Request, link_id):
|
||||
wallet_id=link.wallet,
|
||||
amount=int(amount_received / 1000),
|
||||
memo=link.description,
|
||||
description_hash=link.lnurlpay_metadata.encode("utf-8"),
|
||||
unhashed_description=link.lnurlpay_metadata.encode("utf-8"),
|
||||
extra={
|
||||
"tag": "lnurlp",
|
||||
"link": link.id,
|
||||
|
@ -73,7 +73,7 @@ async def lnurl_callback(request: Request, item_id: int):
|
||||
wallet_id=shop.wallet,
|
||||
amount=int(amount_received / 1000),
|
||||
memo=item.name,
|
||||
description_hash=(await item.lnurlpay_metadata()).encode("utf-8"),
|
||||
unhashed_description=(await item.lnurlpay_metadata()).encode("utf-8"),
|
||||
extra={"tag": "offlineshop", "item": item.id},
|
||||
)
|
||||
except Exception as exc:
|
||||
|
@ -77,7 +77,7 @@ async def api_lnurlp_callback(
|
||||
wallet_id=link.wallet,
|
||||
amount=int(amount_received / 1000),
|
||||
memo="Satsdice bet",
|
||||
description_hash=link.lnurlpay_metadata.encode("utf-8"),
|
||||
unhashed_description=link.lnurlpay_metadata.encode("utf-8"),
|
||||
extra={"tag": "satsdice", "link": link.id, "comment": "comment"},
|
||||
)
|
||||
|
||||
|
@ -87,8 +87,10 @@ class CoreLightningWallet(Wallet):
|
||||
label = "lbl{}".format(random.random())
|
||||
msat: int = int(amount * 1000)
|
||||
try:
|
||||
if description_hash:
|
||||
raise Unsupported("description_hash")
|
||||
if description_hash and not unhashed_description:
|
||||
raise Unsupported(
|
||||
"'description_hash' unsupported by CLN, provide 'unhashed_description'"
|
||||
)
|
||||
if unhashed_description and not self.supports_description_hash:
|
||||
raise Unsupported("unhashed_description")
|
||||
r = self.ln.invoice(
|
||||
|
Loading…
x
Reference in New Issue
Block a user