| 82 | } |
| 83 | |
| 84 | struct channel_update_timestamps * |
| 85 | decode_channel_update_timestamps(const tal_t *ctx, |
| 86 | const struct tlv_reply_channel_range_tlvs_timestamps_tlv *timestamps_tlv) |
| 87 | { |
| 88 | /* Note that our parser will set this to NULL if there are no elements */ |
| 89 | u8 *encoded = timestamps_tlv->encoded_timestamps; |
| 90 | size_t max = tal_count(encoded); |
| 91 | struct channel_update_timestamps *ts; |
| 92 | |
| 93 | /* FIXME: BOLT #7 should have a requirements like it does for |
| 94 | * query_short_channel_ids_tlvs! */ |
| 95 | switch (timestamps_tlv->encoding_type) { |
| 96 | case ARR_ZLIB_DEPRECATED: |
| 97 | return NULL; |
| 98 | case ARR_UNCOMPRESSED: |
| 99 | ts = tal_arr(ctx, struct channel_update_timestamps, 0); |
| 100 | while (max) { |
| 101 | struct channel_update_timestamps t; |
| 102 | fromwire_channel_update_timestamps |
| 103 | (cast_const2(const u8 **, &encoded), |
| 104 | &max, &t); |
| 105 | /* Sets this to NULL if it fails */ |
| 106 | if (!encoded) |
| 107 | return tal_free(ts); |
| 108 | tal_arr_expand(&ts, t); |
| 109 | } |
| 110 | return ts; |
| 111 | } |
| 112 | return NULL; |
| 113 | } |
no test coverage detected