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

Function decode_channel_update_timestamps

common/decode_array.c:84–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84struct channel_update_timestamps *
85decode_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}

Callers 1

append_range_replyFunction · 0.85

Calls 1

tal_freeFunction · 0.85

Tested by

no test coverage detected