-
Notifications
You must be signed in to change notification settings - Fork 902
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
Pay enhancements: remove legacy, add maxfee and description params #5122
Pay enhancements: remove legacy, add maxfee and description params #5122
Conversation
b0cf6b0
to
a4c1d38
Compare
Trips on our RPC checking introduced at the same time: msat should be an integer or an "xxxmsat"/sat/btc string. Signed-off-by: Rusty Russell <[email protected]>
I think the new pay command has proven itself in the last 18 months! Also various pay tests took "compat" then didn't use it, so clean them up. Signed-off-by: Rusty Russell <[email protected]> Changelog-Removed: JSON-RPC: `legacypay` (`pay` replaced it in 0.9.0).
Fixes: ElementsProject#4665 Reported-by: @shesek Signed-off-by: Rusty Russell <[email protected]>
This is what LND does, and it's better for upper layers than trying to twist our maxfeepercent / exemptfee heuristics to suit. (I don't remember who complained about this, sorry!) I'm doing this now because I want to add YA parameter next! Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON-RPC: `pay` has new parameter `maxfee` for setting absolute fee (instead of using `maxfeepercent` and/or `exemptfee`)
Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON-RPC: `pay` has `description` parameter, will be required if bolt11 only has a hash. Changelog-Deprecated: JSON-RPC: `pay` for a bolt11 which uses a `description_hash`, without setting `description`.
…ash. Signed-off-by: Rusty Russell <[email protected]>
a4c1d38
to
2a4a412
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.
The requirement for description
to be provided as a raw JSON value is too much of a restriction, and copying a potentially large description around to every single sendpay
is a horrible waste of bytes (as well as copying the invstring
, but that somehow sneaked in while I wasn't looking).
plugins/libplugin-pay.c
Outdated
if (p->description) | ||
c->description = tal_strdup(c, p->description); |
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.
This is really bad, as it replicates the description in all child-payments, bloating the database with duplicate values. I thought we did the sane thing, and didn't copy the invstring
either, as that is constant in the entire tree, but apparently it got changed somewhere along the line.
There is no point in duplicating these values, and we can use the convention of attaching them only to the root payment.
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.
Hmm, fixing this is a significant change. Let me try... (and add a test!). I copied the invstring, assuming that was doing The Right Thing.
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.
Actually, this was all a mess! This duplicate is only for the pre-splitter, but it turns out we were often returning listpays() without any bolt11.
I've fixed that.
*description* is only required for bolt11 invoices which do not | ||
contain a description themselves, but contain a description hash. | ||
*description* is then checked against the hash inside the invoice | ||
before it will be paid. |
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.
This requirement is incredibly restrictive: it limits us to invoices with description_hash
where the description
itself is representable as a raw JSON value. Anything like a PDF, which is something that people have been asking for, is essentially impossible to do with this, unless we allows a hex-encoded value to be provided instead, which makes this cumbersome to use. I know I voted in favor of requiring the description
but this version is too limiting imho
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.
Yes, the limits of json!
But we can add descriptionhex later for this case?
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.
I looked at this, we need a non-trivial amount of re-engineering to add this. We cannot handle bolt11 descriptions which are not basically valid strings right now, and changing that would be an API change everywhere we print description.
So I'm leaving that for next release.
a2d89a4
to
586407b
Compare
We were setting it on the root, but that doesn't get handed to sendpay. Our schema doesn't *require* bolt11, either, so this was missed (there could be a *bolt12* instead). Signed-off-by: Rusty Russell <[email protected]> Changelog-Fixed: JSON-RPC: `listpays` always includes `bolt11` or `bolt12` field.
Signed-off-by: Rusty Russell <[email protected]>
586407b
to
9d71db2
Compare
(Fixed keysend with the new invstring deduplication: it can still be NULL in this case! |
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, just some minor doc format, where I'm not sure that the suggested syntax is required.
ACK 9d71db2
@@ -5,8 +5,8 @@ SYNOPSIS | |||
-------- | |||
|
|||
**pay** *bolt11* [*msatoshi*] [*label*] [*riskfactor*] | |||
[*maxfeepercent*] [*retry\_for*] [*maxdelay*] [*exemptfee*] | |||
[*exclude*] | |||
[*maxfeepercent*] [*retry_for*] [*maxdelay*] [*exemptfee*] |
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.
[*maxfeepercent*] [*retry_for*] [*maxdelay*] [*exemptfee*] | |
[*maxfeepercent*] [*retry\_for*] [*maxdelay*] [*exemptfee*] |
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.
No, we've been eliminating those _
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.
oh ok is the opposite!
[*bolt11*] [*payment_secret*] [*partid*] [*localofferid*] [*groupid*] | ||
[*payment_metadata*] [*description*] |
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.
[*bolt11*] [*payment_secret*] [*partid*] [*localofferid*] [*groupid*] | |
[*payment_metadata*] [*description*] | |
[*bolt11*] [*payment\_secret*] [*partid*] [*localofferid*] [*groupid*] | |
[*payment\_metadata*] [*description*] |
this is not a new change, at this point, I'm not really sure that \
is required!
This builds on #5121 (first three commits).merged, rebasedThat PR made me realize we violate bolt11 when paying a description_hash invoice, so add a description parameter and deprecate payment of such an invoice without it, and I want to do that this release if possible.
However, there was some more work I wanted to do on the way...