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