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

Function json_add_blindedpath

lightningd/onion_message.c:18–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16};
17
18static void json_add_blindedpath(struct plugin *plugin,
19 struct json_stream *stream,
20 const char *fieldname,
21 const struct blinded_path *path)
22{
23 json_object_start(stream, fieldname);
24 if (path->first_node_id.is_pubkey) {
25 json_add_pubkey(stream, "first_node_id", &path->first_node_id.pubkey);
26 } else {
27 json_add_short_channel_id(stream, "first_scid", path->first_node_id.scidd.scid);
28 json_add_u32(stream, "first_scid_dir", path->first_node_id.scidd.dir);
29 }
30 json_add_pubkey(stream, "first_path_key", &path->first_path_key);
31 json_array_start(stream, "hops");
32 for (size_t i = 0; i < tal_count(path->path); i++) {
33 json_object_start(stream, NULL);
34 json_add_pubkey(stream, "blinded_node_id",
35 &path->path[i]->blinded_node_id);
36 json_add_hex_talarr(stream, "encrypted_recipient_data",
37 path->path[i]->encrypted_recipient_data);
38 json_object_end(stream);
39 };
40 json_array_end(stream);
41 json_object_end(stream);
42}
43
44static void onion_message_serialize(struct onion_message_hook_payload *payload,
45 struct json_stream *stream,

Callers 1

onion_message_serializeFunction · 0.85

Calls 8

json_object_startFunction · 0.85
json_add_pubkeyFunction · 0.85
json_add_u32Function · 0.85
json_array_startFunction · 0.85
json_add_hex_talarrFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85

Tested by

no test coverage detected