lightningd: make the caller set invreq_metadata and invreq_payer_id for createinvoicerequest.

It's an internal undocumented interface, which makes this change less painful.

We *do* check that the invreq_metadata maps to the given invreq_payer_id, which would
is required for us to sign it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-08-01 09:33:36 +09:30
parent 74ef03d361
commit 71270ae795
4 changed files with 66 additions and 42 deletions

View File

@@ -674,7 +674,8 @@ struct command_result *json_invoicerequest(struct command *cmd,
*...
* - MUST set `invreq_payer_id` as it would set `offer_issuer_id` for an offer.
*/
/* createinvoicerequest sets this! */
/* FIXME: Allow invoicerequests using aliases! */
invreq->invreq_payer_id = tal_dup(invreq, struct pubkey, &id);
/* BOLT-offers #12:
* - if it supports bolt12 invoice request features:
@@ -685,8 +686,6 @@ struct command_result *json_invoicerequest(struct command *cmd,
invreq);
json_add_string(req->js, "bolt12", invrequest_encode(tmpctx, invreq));
json_add_bool(req->js, "savetodb", true);
/* FIXME: Allow invoicerequests using aliases! */
json_add_bool(req->js, "exposeid", true);
json_add_bool(req->js, "single_use", *single_use);
if (label)
json_add_string(req->js, "recurrence_label", label);