ACINQ / phoenix

Phoenix is a self-custodial Bitcoin wallet using Lightning to send/receive payments.
https://phoenix.acinq.co
Apache License 2.0
644 stars 97 forks source link

"invoice must have a description hash" error when paying lightning address #213

Closed laanwj closed 2 years ago

laanwj commented 2 years ago

We're trying to set up payment to a lightning address, I have (as far as I know) set up everything correctly, including the well-known URL, and the callback service returning an invoice in the PR field. The payment flow seems to work (it's possible to enter an amount and comment), however during pay it fails with the error

No payment sent. The service 'x0f.org' provided an invalid invoice (invoice must have a description hash)

It seems that this refers to the description_hash field in the BOLT11 invoice. However, c-lightning doesn't have a way to set this. I can't find any mention of this being mandatory in LNURL LUD-06. It's only mentioned in LUD-18, which we haven't implemented (and would be difficult, given that c-lightning doesn't have a way to do it without manipulating BOLT11 internals manually).

Is this a bug or intentional?

laanwj commented 2 years ago

Closing this, we have a solution for this now.

t-bast commented 2 years ago

The specification says:

[A Bolt11 invoice]:
  - MUST include either exactly one d or exactly one h field. 

It means an invoice must include either a description or a description hash to be valid. Phoenix checks for this "standardness" and rejects invalid invoices. I'm quite surprised you were able to create invoices that didn't have any of those, that would indicate c-lightning lets you create invoices that are not spec-compliant?

Glad you found a solution anyway.

dpad85 commented 2 years ago

I can't find any mention of this being mandatory in LNURL LUD-06.

For the record, it's bullet point 7 of LUD-06 (LN WALLET Verifies that h tag in provided invoice is a hash of metadata string converted to byte array in UTF-8 encoding.). The intent is that the wallet checks that the actual invoice is consistent with the payment that has been initially announced by the service.