wire/tlvstream: add tlv_make_fields helper to populate ->fields array.

This is vital for calculating merkle trees; I previously used
towire+fromwire to get this!

Requires generation change so we can magic the ARRAY_SIZE var (the C
pre-processor can't uppercase things).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-12-04 10:30:22 +10:30
committed by neil saitug
parent 5c167d16ab
commit ff8830876d
39 changed files with 72 additions and 40 deletions

View File

@@ -121,7 +121,7 @@ bool ${tlv.name}_is_valid(const struct ${tlv.struct_name()} *record,
size_t *err_index);
% if tlv.name in options.expose_tlv_type:
#define TLVS_${tlv.name.upper()}_ARRAY_SIZE ${len(tlv.messages)}
#define TLVS_ARRAY_SIZE_${tlv.name} ${len(tlv.messages)}
extern const struct tlv_record_type tlvs_${tlv.name}[];
<%!