Skip to content

Commit aa5807d

Browse files
committed
-Fixing offers when offer_paths are present and offer_issuer_id is no
longer needed. -There is a missing piece however in plugins/offers_invreq_hook.c, which causes an error in plugins/fetchinvoice.c when trying to fetch an invoice for an offer without offer_issuer _id. Comments were added to describe the remaining issue.
1 parent 85e97bf commit aa5807d

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

plugins/fetchinvoice.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ static struct command_result *handle_invreq_response(struct command *cmd,
231231
badfield = "invoice_payment_hash";
232232
goto badinv;
233233
}
234+
/* Currently the following check fails for offers that do not contain
235+
* offer_issuer_id and for which an invoice is fetched from a CLN node,
236+
* because listoffers_done in offers_invrek_hook.c sets invoice_node_id
237+
* to offer_issuer_id regardless.
238+
*/
234239
if (!inv->invoice_node_id) {
235240
badfield = "invoice_node_id";
236241
goto badinv;

plugins/offers_invreq_hook.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,11 @@ static struct command_result *listoffers_done(struct command *cmd,
993993
* - MUST set `invoice_node_id` to the `offer_issuer_id`
994994
*/
995995
/* FIXME: We always provide an offer_issuer_id! */
996+
/* The following line is wrong when offer_issuer_id is not used.
997+
* According to fetchinvoice.c, it should be "equal to the final
998+
* `blinded_node_id` it [the payer] sent the invoice request to", when
999+
* offer_issuer_id is not set and offer_paths is set
1000+
*/
9961001
ir->inv->invoice_node_id = ir->inv->offer_issuer_id;
9971002

9981003
/* BOLT #12:

plugins/offers_offer.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ static struct command_result *found_best_peer(struct command *cmd,
269269
struct secret blinding_path_secret;
270270
struct sha256 offer_id;
271271

272+
/* offer_issuer_id is not needed when offer_paths are used.
273+
* The following line seems to produce a valid offer with
274+
* offer_issuer_id removed.
275+
*/
276+
offinfo->offer->offer_issuer_id = NULL;
277+
272278
/* Note: "id" of offer minus paths */
273279
offer_offer_id(offinfo->offer, &offer_id);
274280

0 commit comments

Comments
 (0)