MCPcopy Create free account
hub / github.com/ElementsProject/lightning / decode_scid_query_flags

Function decode_scid_query_flags

common/decode_array.c:45–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45bigsize_t *decode_scid_query_flags(const tal_t *ctx,
46 const struct tlv_query_short_channel_ids_tlvs_query_flags *qf)
47{
48 u8 *encoded = qf->encoded_query_flags;
49 size_t max = tal_count(encoded);
50 bigsize_t *flags;
51
52 /* BOLT #7:
53 *
54 * The receiver:
55 *...
56 * - if the incoming message includes `query_short_channel_ids_tlvs`:
57 * - if `encoding_type` is not a known encoding type:
58 * - MAY send a `warning`.
59 * - MAY close the connection.
60 * - if `encoded_query_flags` does not decode to exactly one flag per
61 * `short_channel_id`:
62 * - MAY send a `warning`.
63 * - MAY close the connection.
64 */
65 switch (qf->encoding_type) {
66 case ARR_ZLIB_DEPRECATED:
67 return NULL;
68 case ARR_UNCOMPRESSED:
69 flags = tal_arr(ctx, bigsize_t, 0);
70 while (max)
71 tal_arr_expand(&flags,
72 fromwire_bigsize(cast_const2(const u8 **,
73 &encoded),
74 &max));
75
76 /* encoded is set to NULL if we ran over */
77 if (!encoded)
78 return tal_free(flags);
79 return flags;
80 }
81 return NULL;
82}
83
84struct channel_update_timestamps *
85decode_channel_update_timestamps(const tal_t *ctx,

Callers 1

Calls 2

tal_freeFunction · 0.85
fromwire_bigsizeFunction · 0.70

Tested by

no test coverage detected