| 9 | #include <sodium.h> |
| 10 | |
| 11 | struct 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. */ |
no outgoing calls
no test coverage detected