BOLT #4: * * ### `payload` format * * This is formatted according to the Type-Length-Value format defined * in [BOLT #1](01-messaging.md#type-length-value-format). */
| 13 | * in [BOLT #1](01-messaging.md#type-length-value-format). |
| 14 | */ |
| 15 | static u8 *make_tlv_hop(const tal_t *ctx, |
| 16 | const struct tlv_payload *tlv) |
| 17 | { |
| 18 | /* We can't have over 64k anyway */ |
| 19 | u8 *tlvs = tal_arr(ctx, u8, 3); |
| 20 | |
| 21 | towire_tlv_payload(&tlvs, tlv); |
| 22 | |
| 23 | switch (bigsize_put(tlvs, tal_bytelen(tlvs) - 3)) { |
| 24 | case 1: |
| 25 | /* Move over two unused bytes */ |
| 26 | memmove(tlvs + 1, tlvs + 3, tal_bytelen(tlvs) - 3); |
| 27 | tal_resize(&tlvs, tal_bytelen(tlvs) - 2); |
| 28 | return tlvs; |
| 29 | case 3: |
| 30 | return tlvs; |
| 31 | } |
| 32 | abort(); |
| 33 | } |
| 34 | |
| 35 | u8 *onion_nonfinal_hop(const tal_t *ctx, |
| 36 | const struct short_channel_id *scid, |
no test coverage detected