| 568 | } |
| 569 | |
| 570 | static 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 */ |
| 606 | static struct command_result *try_establish(struct command *cmd, |
nothing calls this directly
no test coverage detected