Skip to content

Commit e745414

Browse files
committed
listoffers_done: Fix invoice_node_id so it is set to the final
blinded_node_id when offer_issuer_id is not present and offers_path is present.
1 parent 7c4804c commit e745414

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

plugins/offers_invreq_hook.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -931,16 +931,15 @@ static struct command_result *listoffers_done(struct command *cmd,
931931
assert(ir->inv->invreq_payer_id);
932932

933933
/* BOLT #12:
934-
* - if `offer_issuer_id` is present:
934+
* - if `offer_issuer_id` is present or if `offer_paths` is not present:
935935
* - MUST set `invoice_node_id` to the `offer_issuer_id`
936+
* - else:
937+
* - MUST set `invoice_node_id` to the final `blinded_node_id`
936938
*/
937-
/* FIXME: We always provide an offer_issuer_id! */
938-
/* The following line is wrong when offer_issuer_id is not used.
939-
* According to fetchinvoice.c, it should be "equal to the final
940-
* `blinded_node_id` it [the payer] sent the invoice request to", when
941-
* offer_issuer_id is not set and offer_paths is set
942-
*/
943-
ir->inv->invoice_node_id = ir->inv->offer_issuer_id;
939+
if(!ir->inv->offer_issuer_id && ir->invreq->offer_paths) {
940+
ir->inv->invoice_node_id = &(*ir->invreq->offer_paths)->path[tal_count((*ir->invreq->offer_paths)->path)-1]->blinded_node_id;
941+
942+
} else ir->inv->invoice_node_id = ir->inv->offer_issuer_id;
944943

945944
/* BOLT #12:
946945
* - MUST set `invoice_created_at` to the number of seconds since

0 commit comments

Comments
 (0)