-
Notifications
You must be signed in to change notification settings - Fork 905
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
jsonrpc: Add description_hash parameter to invoice #4892
Conversation
f1c8361
to
8582691
Compare
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.
LGTM, I have only a small comment for the python doc string
8582691
to
704f61d
Compare
I have pushed a new version with (thanks @vincenzopalazzo).
|
704f61d
to
b545587
Compare
Add an optional description_hash parameter to the invoice command. This can be specified instead of the description, to create an invoice that only commits to a 256 bit hash (generally SHA256) of the description. This is used in the lnurlp protocol. See lightningd/plugins#307 for example usage. Closes ElementsProject#4705. Changelog-Added: JSON-RPC: `invoice` now accepts `description_hash` parameter.
b545587
to
4788cba
Compare
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.
ACK 4788cba
Sorry for delay on this! I prefer a boolean flag to say "hash description instead": that way lightningd can save the description in the db and show it in listinvoices. Otherwise you've made an unknown commitment (pun intended!) which it has to honor. We've generally steered away from hashed descriptions, because there was not a transport which used them. Time to bring them back! |
I didnt do this because the descriptions can be extremely long, and in the case of lnurlp they're kind of boring (e.g. it's just the same metadata, which can include images, every time, sometimes with other metadata concatenated). You could store it in the db for every payment but it also seems wasteful in a way. |
You control this though, right? You're issuing the invoice, you'd better control what it says. Otherwise use keysend, it's simpler. |
e0509fb add test/dev.sh (Erik Arvstedt) bbcd704 add test (Erik Arvstedt) 2a336cd shell: add command `nginx-conf` (Erik Arvstedt) aa44d9c website: move obwatcher -> orderbook (Erik Arvstedt) 99313eb website: add rate limiting (Erik Arvstedt) 2e74219 website: extract 'donate' module (Erik Arvstedt) 4a424c5 website: disallow access to btcpayserver root (Erik Arvstedt) aeeaf63 nix-bitcoin-release 0.0.58 (Erik Arvstedt) 79bdca9 add btcpayserver test config (Erik Arvstedt) e1c0b20 shell: add dev helper commands (Erik Arvstedt) 66f955c scenarios: disable joinmarket-ob-watcher (Erik Arvstedt) 656a359 scenarios: extract scenario `disableFeatures` (Erik Arvstedt) 369d608 move scenarios.nix to test/ (Erik Arvstedt) 218232c homepage: add `community` section (Erik Arvstedt) 7b4ea9a website: enable nginx reload (Erik Arvstedt) 69b7012 matrix: use nginx proxy_pass syntax (Erik Arvstedt) Pull request description: This branch is a copy of #22 with LNURL donation support removed. LNURL is [not yet supported](ElementsProject/lightning#4892) by `clighting`. Top commit has no ACKs. Tree-SHA512: dfd3f93843cae8225de4dfca193421dae32bd26be2c262a0598c4a2de8ff33fadf7b31cdd625d451d17a313b51e8ed95e1387ebad91a62f9c05651a53d891c2b
Yes and no. The creator of the invoice controls it. But in the case of lnurlp (the primary use of this), they have to commit to data in a specific format (the metadata string as specified in LUD-06). Wallets do check the I don't think there's an option to use |
Anyhow, I'm happy to rewrite this to use the full description and a boolean argument instead. |
LUD-06 allows embedding base64-encoded images in the description which would needlessly bloat the invoice DB. |
Sure, you can always remove old invoices (in fact, autocleaninvoice does this!) though. It doesn't remove paid ones though, that would need enhancement. We actually already have a 'description' field in the db, and it's wired through (we initially supported creating invoices with description hashes, but nobody used them so we removed the ability). Just hand the description (instead of b11->description, which will be NULL) to wallet_invoice_create() and it will all Just Work. |
The invoice is the contract you're committing to. You really want to save it all by strong default; sure, there are scenarios where you can reproduce it, but storage is cheap. |
Thanks, I'll look into that. |
Some reasons why c-lightning storing the full description is a bad idea:
|
That's a big assumption! You'd be surprised what people start doing to make QR codes smaller.
Sure. Put 1MB in there, and still nobody cares, as long as you expire unused invoices?
Sure, in a perfect world! But in practice they do "hey, I paid this " and you go, "um, you did, I have no idea what that is". The default should never be to discard this information. I'd rather add an option to autoclean to remove it (maybe have delinvoice add a 'desconly' option?). |
LNURL wants this so they can include images etc in descriptions. Replaces: ElementsProject#4892 Changelog-Added: JSON-RPC: `invoice` has a new parameter `deschashonly` to put hash of description in bolt11. Signed-off-by: Rusty Russell <[email protected]>
See #5121 for comparison. |
I'm fine with that one considering the new ways to delete invoices. The benefit is that it might be simpler for some users to delegate the description-hashing process to c-lightning. |
LNURL wants this so they can include images etc in descriptions. Replaces: ElementsProject#4892 Changelog-Added: JSON-RPC: `invoice` has a new parameter `deschashonly` to put hash of description in bolt11. Signed-off-by: Rusty Russell <[email protected]>
LNURL wants this so they can include images etc in descriptions. Replaces: #4892 Changelog-Added: JSON-RPC: `invoice` has a new parameter `deschashonly` to put hash of description in bolt11. Signed-off-by: Rusty Russell <[email protected]>
Merged #5121 instead |
I need this feature as well, not the way it is implemented today (with There are countless apps out there that can only pass the hash and don't have access to the description itself (because they don't really need to and/or want to avoid unnecessary bloat). Afaik, CLN is the only implementation that doesn't accept the hash directly and requires special treatment in LNbits. Having the option to just pass the hash would make many things easier and more efficient. |
+1 we would like to support CLN as a backend in https://github.com/getAlby/lndhub.go |
On Wed, Sep 07, 2022 at 05:29:19AM -0700, kiwiidb wrote:
+1 we would like to support CLN as a backend in https://github.com/getAlby/lndhub.go
But this requires a minimum of API overlap with LND and not being able to do this is a complete blocker :(
In what situation where you would be paying a deschash invoice and you
wouldn't have the description? In lnurl, the static endpoint has the
description (metadata). afaik lnurl is the biggest usages of deschash,
I'm not sure of others, but we shouldn't be encouraging that usecase as
for reasons discussed above.
|
It's not that we don't have the description. It's just that writing a service with multiple node back-ends is more difficult due to this difference in API. I guess we could also make a breaking change and do it this way. |
Add an optional
description_hash
parameter to theinvoice
command. This can be specified instead of thedescription
, to create an invoice that only commits to a 256 bit hash (generally SHA256) of the description.This is used in the
lnurlp
protocol. See lightningd/plugins#307 for example usage.Closes #4705