| 20 | } |
| 21 | |
| 22 | void towire_tlvstream_raw(u8 **pptr, struct tlv_field *fields) |
| 23 | { |
| 24 | if (!fields) |
| 25 | return; |
| 26 | |
| 27 | asort(fields, tal_count(fields), tlv_field_cmp, NULL); |
| 28 | |
| 29 | for (size_t i = 0; i < tal_count(fields); i++) { |
| 30 | const struct tlv_field *field = &fields[i]; |
| 31 | /* BOLT #1: |
| 32 | * |
| 33 | * The sending node: |
| 34 | ... |
| 35 | * - MUST minimally encode `type` and `length`. |
| 36 | */ |
| 37 | towire_bigsize(pptr, field->numtype); |
| 38 | towire_bigsize(pptr, field->length); |
| 39 | towire(pptr, field->value, field->length); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | static struct tlv_field *tlvstream_get_raw(struct tlv_field *stream, u64 type) |
| 44 | { |
no test coverage detected