| 292 | } |
| 293 | |
| 294 | void towire_tlv(u8 **pptr, |
| 295 | const struct tlv_record_type *types, size_t num_types, |
| 296 | const void *record) |
| 297 | { |
| 298 | if (!record) |
| 299 | return; |
| 300 | |
| 301 | for (size_t i = 0; i < num_types; i++) { |
| 302 | u8 *val; |
| 303 | if (i != 0) |
| 304 | assert(types[i].type > types[i-1].type); |
| 305 | val = types[i].towire(NULL, record); |
| 306 | if (!val) |
| 307 | continue; |
| 308 | |
| 309 | /* BOLT #1: |
| 310 | * |
| 311 | * The sending node: |
| 312 | ... |
| 313 | * - MUST minimally encode `type` and `length`. |
| 314 | */ |
| 315 | towire_bigsize(pptr, types[i].type); |
| 316 | towire_bigsize(pptr, tal_bytelen(val)); |
| 317 | towire(pptr, val, tal_bytelen(val)); |
| 318 | tal_free(val); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | struct tlv_field *tlv_make_fields_(const struct tlv_record_type *types, |
| 323 | size_t num_types, |
nothing calls this directly
no test coverage detected