mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
bolt-gen: formatting cleanups
add brackets for clarity when printing subtypes; also remove unnecessary exception (`find_` will raise an exception if the key is not present)
This commit is contained in:
parent
316edb39a4
commit
ff82c918a5
2 changed files with 4 additions and 3 deletions
|
@ -51,7 +51,9 @@ void print${options.enum_name}_message(const u8 *msg)
|
|||
printf("[");
|
||||
for (size_t i = 0; i < ${f.size()}; i++) {
|
||||
% if f.type_obj.is_subtype():
|
||||
printf("{\n");
|
||||
printwire_${f.type_obj.name}(tal_fmt(NULL, "%s.${f.name}", fieldname), ${cursor}, ${plen});
|
||||
printf("}\n");
|
||||
% else:
|
||||
${f.type_obj.type_name()} v;
|
||||
% if f.type_obj.is_assignable():
|
||||
|
@ -71,7 +73,9 @@ void print${options.enum_name}_message(const u8 *msg)
|
|||
% endif
|
||||
${truncate_check(nested)} \
|
||||
% elif f.type_obj.is_subtype():
|
||||
printf("{\n");
|
||||
printwire_${f.type_obj.name}(tal_fmt(NULL, "%s.${f.name}", fieldname), ${cursor}, ${plen});
|
||||
printf("}\n");
|
||||
% else:
|
||||
% if f.type_obj.is_assignable():
|
||||
${f.type_obj.type_name()} ${f.name} = fromwire_${f.type_obj.name}(${cursor}, ${plen});
|
||||
|
|
|
@ -130,9 +130,6 @@ class FieldSet(object):
|
|||
field.add_count(int(count))
|
||||
except ValueError:
|
||||
len_field = self.find_data_field(count)
|
||||
if not len_field:
|
||||
raise ValueError("No length field found with name {} for {}:{}"
|
||||
.format(count, self.name, field_name))
|
||||
field.add_len_field(len_field)
|
||||
self.len_fields[len_field.name] = len_field
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue