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