| 65 | } |
| 66 | |
| 67 | bigsize_t *decode_scid_query_flags(const tal_t *ctx, |
| 68 | const struct tlv_query_short_channel_ids_tlvs_query_flags *qf) |
| 69 | { |
| 70 | u8 *encoded = qf->encoded_query_flags; |
| 71 | size_t max = tal_count(encoded); |
| 72 | bigsize_t *flags; |
| 73 | |
| 74 | /* BOLT #7: |
| 75 | * |
| 76 | * The receiver: |
| 77 | *... |
| 78 | * - if the incoming message includes `query_short_channel_ids_tlvs`: |
| 79 | * - if `encoding_type` is not a known encoding type: |
| 80 | * - MAY send a `warning`. |
| 81 | * - MAY close the connection. |
| 82 | * - if `encoded_query_flags` does not decode to exactly one flag per |
| 83 | * `short_channel_id`: |
| 84 | * - MAY send a `warning`. |
| 85 | * - MAY close the connection. |
| 86 | */ |
| 87 | switch (qf->encoding_type) { |
| 88 | case ARR_ZLIB_DEPRECATED: |
| 89 | encoded = unzlib(tmpctx, encoded, max); |
| 90 | if (!encoded) |
| 91 | return NULL; |
| 92 | max = tal_count(encoded); |
| 93 | /* fall thru */ |
| 94 | case ARR_UNCOMPRESSED: |
| 95 | flags = tal_arr(ctx, bigsize_t, 0); |
| 96 | while (max) |
| 97 | tal_arr_expand(&flags, |
| 98 | fromwire_bigsize(cast_const2(const u8 **, |
| 99 | &encoded), |
| 100 | &max)); |
| 101 | |
| 102 | /* encoded is set to NULL if we ran over */ |
| 103 | if (!encoded) |
| 104 | return tal_free(flags); |
| 105 | return flags; |
| 106 | } |
| 107 | return NULL; |
| 108 | } |
| 109 | |
| 110 | struct channel_update_timestamps * |
| 111 | decode_channel_update_timestamps(const tal_t *ctx, |
nothing calls this directly
no test coverage detected