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

Function fromwire_len_and_tlvstream

common/htlc_wire.c:197–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197static struct tlv_field *fromwire_len_and_tlvstream(const tal_t *ctx,
198 const u8 **cursor, size_t *max)
199{
200 struct tlv_field *tlvs = tal_arr(ctx, struct tlv_field, 0);
201 size_t len = fromwire_u16(cursor, max);
202
203 /* Subtle: we are not using fromwire_tal_arrn here, which
204 * would do this. */
205 if (len > *max) {
206 fromwire_fail(cursor, max);
207 return NULL;
208 }
209
210 /* NOTE: We might consider to be more strict and only allow for
211 * known tlv types from the tlvs_tlv_update_add_htlc_tlvs
212 * record. */
213 if (!fromwire_tlv(cursor, &len, NULL, 0, cast_const(void *, ctx),
214 &tlvs, FROMWIRE_TLV_ANY_TYPE, NULL, NULL))
215 return tal_free(tlvs);
216 return tlvs;
217}
218
219struct added_htlc *fromwire_added_htlc(const tal_t *ctx, const u8 **cursor,
220 size_t *max)

Callers 2

fromwire_added_htlcFunction · 0.85
fromwire_existing_htlcFunction · 0.85

Calls 4

tal_freeFunction · 0.85
fromwire_u16Function · 0.50
fromwire_failFunction · 0.50
fromwire_tlvFunction · 0.50

Tested by

no test coverage detected