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

Function establish_path_done

plugins/fetchinvoice.c:570–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570static struct command_result *establish_path_done(struct command *cmd,
571 const struct pubkey *path,
572 struct establishing_paths *epaths)
573{
574 struct onion_message *omsg;
575 struct sent *sent = epaths->sent;
576 struct tlv_onionmsg_tlv *final_tlv = epaths->final_tlv;
577
578 /* Create transient secret so we can validate reply! */
579 sent->reply_secret = tal(sent, struct secret);
580
581 assert(tal_count(path) > 0);
582
583 /* Add reply path to final_tlv (it already contains invoice_request/invoice) */
584 if (epaths->want_reply) {
585 final_tlv->reply_path = make_reply_path(final_tlv, cmd->plugin, sent, path, sent->reply_secret);
586
587 /* Replace first hop with scidd if they said to */
588 if (sent->dev_path_use_scidd)
589 sciddir_or_pubkey_from_scidd(&final_tlv->reply_path->first_node_id,
590 sent->dev_path_use_scidd);
591 }
592
593 /* Put in list so we recognize reply onion message. Note: because
594 * onion message notification comes from a different fd than the one
595 * we send this command to, it can actually be processed *before* we
596 * call done() */
597 sent->cmd = cmd;
598 list_add_tail(&sent_list, &sent->list);
599 tal_add_destructor(sent, destroy_sent);
600
601 omsg = outgoing_onion_message(tmpctx, path, NULL, current_their_path(epaths), final_tlv);
602 return inject_onionmessage(cmd, omsg, epaths->done, forward_error, sent);
603}
604
605/* Mutual recursion */
606static struct command_result *try_establish(struct command *cmd,

Callers

nothing calls this directly

Calls 4

make_reply_pathFunction · 0.85
outgoing_onion_messageFunction · 0.85
current_their_pathFunction · 0.85

Tested by

no test coverage detected