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

Function send_onion_reply

plugins/offers.c:46–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46struct command_result *
47send_onion_reply(struct command *cmd,
48 struct tlv_onionmsg_payload_reply_path *reply_path,
49 struct tlv_onionmsg_payload *payload)
50{
51 struct out_req *req;
52 size_t nhops;
53
54 req = jsonrpc_request_start(cmd->plugin, cmd, "sendonionmessage",
55 finished, sendonionmessage_error, NULL);
56
57 json_add_pubkey(req->js, "first_id", &reply_path->first_node_id);
58 json_add_pubkey(req->js, "blinding", &reply_path->blinding);
59 json_array_start(req->js, "hops");
60
61 nhops = tal_count(reply_path->path);
62 for (size_t i = 0; i < nhops; i++) {
63 struct tlv_onionmsg_payload *omp;
64 u8 *tlv;
65
66 json_object_start(req->js, NULL);
67 json_add_pubkey(req->js, "id", &reply_path->path[i]->node_id);
68
69 /* Put payload in last hop. */
70 if (i == nhops - 1)
71 omp = payload;
72 else
73 omp = tlv_onionmsg_payload_new(tmpctx);
74
75 omp->encrypted_data_tlv = reply_path->path[i]->encrypted_recipient_data;
76
77 tlv = tal_arr(tmpctx, u8, 0);
78 towire_tlv_onionmsg_payload(&tlv, omp);
79 json_add_hex_talarr(req->js, "tlv", tlv);
80 json_object_end(req->js);
81 }
82 json_array_end(req->js);
83 return send_outreq(cmd->plugin, req);
84}
85
86static struct command_result *onion_message_modern_call(struct command *cmd,
87 const char *buf,

Callers 3

fail_invreq_levelFunction · 0.85
createinvoice_doneFunction · 0.85
fail_inv_levelFunction · 0.85

Calls 7

json_add_pubkeyFunction · 0.85
send_outreqFunction · 0.70
json_array_startFunction · 0.50
json_object_startFunction · 0.50
json_add_hex_talarrFunction · 0.50
json_object_endFunction · 0.50
json_array_endFunction · 0.50

Tested by

no test coverage detected