MCPcopy Create free account
hub / github.com/ElementsProject/lightning / try_establish

Function try_establish

plugins/fetchinvoice.c:595–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595static struct command_result *try_establish(struct command *cmd,
596 struct establishing_paths *epaths)
597{
598 const struct offers_data *od = get_offers_data(cmd->plugin);
599 struct pubkey target;
600
601 if (epaths->sent->direct_dest) {
602 target = *epaths->sent->direct_dest;
603 } else {
604 const struct blinded_path *bpath = current_their_path(epaths);
605 struct sciddir_or_pubkey first = bpath->first_node_id;
606 if (!gossmap_scidd_pubkey(get_gossmap(cmd->plugin), &first))
607 return establish_path_fail(cmd, "Cannot resolve scidd", epaths);
608 target = first.pubkey;
609 /* BOLT #12:
610 * - if `offer_issuer_id` is present (invoice_request for an offer):
611 * - MUST reject the invoice if `invoice_node_id` is not equal to `offer_issuer_id`
612 * - otherwise, if `offer_paths` is present (invoice_request for an offer without id):
613 * - MUST reject the invoice if `invoice_node_id` is not equal to the final `blinded_node_id` it sent the invoice request to.
614 */
615 if (epaths->sent->offer && !epaths->sent->offer->offer_issuer_id)
616 epaths->sent->issuer_key = &bpath->path[tal_count(bpath->path)-1]->blinded_node_id;
617 }
618
619 return establish_onion_path(cmd, get_gossmap(cmd->plugin), &od->id, &target,
620 od->disable_connect,
621 establish_path_done,
622 establish_path_fail,
623 epaths);
624}
625
626static struct command_result *send_message(struct command *cmd,
627 struct sent *sent,

Callers 2

establish_path_failFunction · 0.85
send_messageFunction · 0.85

Calls 5

get_offers_dataFunction · 0.85
current_their_pathFunction · 0.85
gossmap_scidd_pubkeyFunction · 0.85
establish_path_failFunction · 0.85
get_gossmapFunction · 0.70

Tested by

no test coverage detected