| 50 | } |
| 51 | |
| 52 | void tlvstream_set_raw(struct tlv_field **stream, u64 type, const void *value TAKES, size_t valuelen) |
| 53 | { |
| 54 | struct tlv_field f, *e = tlvstream_get_raw(*stream, type); |
| 55 | |
| 56 | if (e != NULL) { |
| 57 | tal_free(e->value); |
| 58 | e->length = valuelen; |
| 59 | e->value = tal_dup_arr(*stream, u8, value, e->length, 0); |
| 60 | } else { |
| 61 | /* If we haven't found it insert it insead. We have no |
| 62 | * tlv_record_type for it, so it's an unknown field. */ |
| 63 | f.meta = NULL; |
| 64 | f.length = valuelen; |
| 65 | f.numtype = type; |
| 66 | f.value = tal_dup_arr(*stream, u8, value, f.length, 0); |
| 67 | tal_arr_expand(stream, f); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void tlvstream_set_short_channel_id(struct tlv_field **stream, u64 type, |
| 72 | struct short_channel_id value) |
no test coverage detected