-
Notifications
You must be signed in to change notification settings - Fork 913
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
bolt12: allow to inject payer_metadata #7786
bolt12: allow to inject payer_metadata #7786
Conversation
0910917
to
28a2882
Compare
@rustyrussell why CLN is rate limiting the onion message? This is a case that is happening in CI https://github.com/ElementsProject/lightning/actions/runs/11644467250/job/32426697525?pr=7786
|
You want to use invreq_payer_note for this I think? If metadata is predictable, then someone can grind to reveal all the values in proof of payment, if you publish one. |
28a2882
to
f5964a9
Compare
Doing trivial rebase, and using tok_bin_from_hex. |
f5964a9
to
3df0bbe
Compare
Added a delay in the test (too fast locally), and enhanced fetchinvoice to check args better too. |
assert decode1['invreq_payer_id'] != decode2['invreq_payer_id'] | ||
|
||
# Delay to avoid sending too many onion messages per second! | ||
time.sleep(1) |
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.
nice catch thanks!
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 3df0bbe
Sounds good to me leaving this merge to you, while leaving some question
plugins/fetchinvoice.c
Outdated
@@ -835,6 +835,9 @@ struct command_result *json_fetchinvoice(struct command *cmd, | |||
p_opt("recurrence_label", param_string, &rec_label), | |||
p_opt_def("timeout", param_number, &timeout, 60), | |||
p_opt("payer_note", param_string, &payer_note), | |||
/* The payer_metadata is passed in hex format and then converted internally | |||
* in binary when needed */ | |||
p_opt("payer_metadata", param_string, &payer_metadata_hex), |
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.
json_tok_bin_from_hex() does this for you!
Payer metadata is a field that controls the payer ID provided during the fetchinvoice process. There are use cases where this is highly useful, such as proving that the payer has paid for the correct item. Imagine visiting a merchant's website to pay for multiple offers, where one of these offers is a default offer (with no description and no set amount). In this scenario, the merchant could claim not to have received payment for a specific item. Since the same offer may be used to fetch invoices for different products, there needs to be a way to identify which product the invoice corresponds to. With this commit, it will be possible to inject payer metadata, which helps solve the issue described above. For example, possible payer metadata could be `to_hex(b"{payer_node_id}.{product_id}.{created_at}")`. Changelog-Added: JSON-RPC: `fetchinvoice` allows setting invreq_metadata via `payer_metadata` parameter. Signed-off-by: Vincenzo Palazzo <[email protected]>
Signed-off-by: Vincenzo Palazzo <[email protected]>
We do a lot more parameter checking than simply parsing, so use param_check(). Signed-off-by: Rusty Russell <[email protected]>
3df0bbe
to
3e6f32b
Compare
Trivial rebase for flake fixes... |
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 3e6f32b
ba7bf33
into
ElementsProject:master
Payer metadata is a field that controls the payer ID
provided during the fetchinvoice process.
There are use cases where this is highly useful, such as
proving that the payer has paid for the correct item.
Imagine visiting a merchant's website to pay for multiple offers, where
one of these offers is a default offer (with no description and no set amount).
In this scenario, the merchant could claim not to have received
payment for a specific item. Since the same offer may be used to
fetch invoices for different products, there needs to be a way to
identify which product the invoice corresponds to.
With this commit, it will be possible to inject payer metadata,
which helps solve the issue described above.
For example, possible payer metadata could be
to_hex(b"{payer_node_id}.{product_id}.{created_at}")
.See 8b457bc for a code example
Opening a PR to give a run to the tests, There is probably something else needs to be hammered but opening as a draft just to take the lock for the upcoming release.