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

Function new_encdata_tlvs

common/onion_message.c:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <sodium.h>
10
11struct tlv_encrypted_data_tlv **new_encdata_tlvs(const tal_t *ctx,
12 const struct pubkey *ids,
13 const struct short_channel_id **scids)
14{
15 struct tlv_encrypted_data_tlv **etlvs;
16
17 etlvs = tal_arr(ctx, struct tlv_encrypted_data_tlv *, tal_count(ids));
18 for (size_t i = 0; i < tal_count(etlvs); i++) {
19 etlvs[i] = tlv_encrypted_data_tlv_new(etlvs);
20 if (i+1 < tal_count(scids) && scids[i+1]) {
21 etlvs[i]->short_channel_id = tal_dup(etlvs[i],
22 struct short_channel_id,
23 scids[i+1]);
24 } else if (i + 1 < tal_count(ids)) {
25 etlvs[i]->next_node_id = tal_dup(etlvs[i],
26 struct pubkey,
27 &ids[i+1]);
28 }
29 }
30 return etlvs;
31}
32
33/* We can extract nodeid from ids[], but usually we can get it from the
34 * previous next_node_id. */

Callers 3

outgoing_onion_messageFunction · 0.85
found_best_peerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected