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

Function towire_tlvstream_raw

wire/tlvstream.c:22–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void towire_tlvstream_raw(u8 **pptr, struct tlv_field *fields)
23{
24 if (!fields)
25 return;
26
27 asort(fields, tal_count(fields), tlv_field_cmp, NULL);
28
29 for (size_t i = 0; i < tal_count(fields); i++) {
30 const struct tlv_field *field = &fields[i];
31 /* BOLT #1:
32 *
33 * The sending node:
34 ...
35 * - MUST minimally encode `type` and `length`.
36 */
37 towire_bigsize(pptr, field->numtype);
38 towire_bigsize(pptr, field->length);
39 towire(pptr, field->value, field->length);
40 }
41}
42
43static struct tlv_field *tlvstream_get_raw(struct tlv_field *stream, u64 type)
44{

Callers 3

handle_onion_messageFunction · 0.85
htlc_accepted_continueFunction · 0.85
payment_sendonionFunction · 0.85

Calls 2

towireFunction · 0.70
towire_bigsizeFunction · 0.50

Tested by

no test coverage detected