-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: check description_hash only if defined #735
Conversation
@@ -106,7 +106,8 @@ const lnurl = { | |||
console.error(); | |||
} | |||
switch (true) { | |||
case paymentRequestDetails.description_hash !== metadataHash: // LN WALLET Verifies that h tag (description_hash) in provided invoice is a hash of metadata string converted to byte array in UTF-8 encoding | |||
case paymentRequestDetails.description_hash && | |||
paymentRequestDetails.description_hash !== metadataHash: // LN WALLET Verifies that h tag (description_hash) in provided invoice is a hash of metadata string converted to byte array in UTF-8 encoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work as well?
case paymentRequestDetails?.description_hash !== metadataHash:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works when description_hash
is set. See #726 — all LND-made I saw invoices contain description_hash
and work well with Alby even without this change.
I think the LNURL spec defines that the description_hash MUST be defined and payments must be rejected if false. Or am I wrong there? |
@bumi |
It's optional in the payment request but I think the LNURL spec requires it: https://github.com/fiatjaf/lnurl-rfc/blob/legacy/lnurl-pay.md see
|
@fiatjaf Please comment. |
@bumi Do you think this change in C-Lightning would help? ElementsProject/lightning#5128 |
|
Closing this. I came to it totally unaware of ElementsProject/lightning#5121 Yes, it needs to be fixed in c-lightning. Thank you @bumi for your patience while I took time to understand what's going on here. |
thanks for reporting, happy we found and learned something. |
Link this PR to an issue
Fixes #726
Type of change
Describe the changes you have made in this PR -
Check if the
description_hash
field is defined before checking it's content equals to the manually assembled one.How Has This Been Tested?
See #726. It would be repetitive to write it here again.
Checklist: