| 634 | } |
| 635 | |
| 636 | static struct command_result *try_establish(struct command *cmd, |
| 637 | struct establishing_paths *epaths) |
| 638 | { |
| 639 | const struct offers_data *od = get_offers_data(cmd->plugin); |
| 640 | struct pubkey target; |
| 641 | |
| 642 | if (epaths->sent->direct_dest) { |
| 643 | target = *epaths->sent->direct_dest; |
| 644 | } else { |
| 645 | const struct blinded_path *bpath = current_their_path(epaths); |
| 646 | struct sciddir_or_pubkey first = bpath->first_node_id; |
| 647 | if (!gossmap_scidd_pubkey(get_gossmap(cmd->plugin), &first)) |
| 648 | return establish_path_fail(cmd, "Cannot resolve scidd", epaths); |
| 649 | target = first.pubkey; |
| 650 | /* BOLT #12: |
| 651 | * - if `offer_issuer_id` is present (invoice_request for an offer): |
| 652 | * - MUST reject the invoice if `invoice_node_id` is not equal to `offer_issuer_id` |
| 653 | * - otherwise, if `offer_paths` is present (invoice_request for an offer without id): |
| 654 | * - MUST reject the invoice if `invoice_node_id` is not equal to the final `blinded_node_id` it sent the invoice request to. |
| 655 | */ |
| 656 | if (epaths->sent->offer && !epaths->sent->offer->offer_issuer_id) |
| 657 | epaths->sent->issuer_key = &bpath->path[tal_count(bpath->path)-1]->blinded_node_id; |
| 658 | } |
| 659 | |
| 660 | return establish_onion_path(cmd, get_gossmap(cmd->plugin), &od->id, &target, |
| 661 | od->disable_connect, |
| 662 | establish_path_done, |
| 663 | establish_path_fail, |
| 664 | epaths); |
| 665 | } |
| 666 | |
| 667 | static struct command_result *send_message(struct command *cmd, |
| 668 | struct sent *sent, |
no test coverage detected