mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
wire-gen: put tlv's after subtypes
in the output, we need tlv's to come after the subtype declarations and structs so that a tlv can use a subtype without problems
This commit is contained in:
committed by
Christian Decker
parent
560f45cd7f
commit
8326f6a35c
@@ -1496,15 +1496,6 @@ else:
|
|||||||
towire_decls = []
|
towire_decls = []
|
||||||
fromwire_decls = []
|
fromwire_decls = []
|
||||||
|
|
||||||
for tlv_field, tlv_messages in tlv_fields.items():
|
|
||||||
for m in tlv_messages:
|
|
||||||
towire_decls.append(m.print_towire(options.header, tlv_field))
|
|
||||||
fromwire_decls.append(m.print_fromwire(options.header, tlv_field))
|
|
||||||
|
|
||||||
if not options.header:
|
|
||||||
towire_decls += build_tlv_towires(tlv_fields)
|
|
||||||
fromwire_decls += build_tlv_fromwires(tlv_fields)
|
|
||||||
|
|
||||||
if not options.header or (options.header and options.subtypes):
|
if not options.header or (options.header and options.subtypes):
|
||||||
subtype_towires = []
|
subtype_towires = []
|
||||||
subtype_fromwires = []
|
subtype_fromwires = []
|
||||||
@@ -1516,6 +1507,15 @@ else:
|
|||||||
towire_decls += subtype_towires
|
towire_decls += subtype_towires
|
||||||
fromwire_decls += subtype_fromwires
|
fromwire_decls += subtype_fromwires
|
||||||
|
|
||||||
|
for tlv_field, tlv_messages in tlv_fields.items():
|
||||||
|
for m in tlv_messages:
|
||||||
|
towire_decls.append(m.print_towire(options.header, tlv_field))
|
||||||
|
fromwire_decls.append(m.print_fromwire(options.header, tlv_field))
|
||||||
|
|
||||||
|
if not options.header:
|
||||||
|
towire_decls += build_tlv_towires(tlv_fields)
|
||||||
|
fromwire_decls += build_tlv_fromwires(tlv_fields)
|
||||||
|
|
||||||
towire_decls += [m.print_towire(options.header) for m in toplevel_messages + messages_with_option]
|
towire_decls += [m.print_towire(options.header) for m in toplevel_messages + messages_with_option]
|
||||||
fromwire_decls += [m.print_fromwire(options.header) for m in toplevel_messages + messages_with_option]
|
fromwire_decls += [m.print_fromwire(options.header) for m in toplevel_messages + messages_with_option]
|
||||||
decls = fromwire_decls + towire_decls
|
decls = fromwire_decls + towire_decls
|
||||||
@@ -1528,5 +1528,5 @@ print(template.format(
|
|||||||
enumname=options.enumname,
|
enumname=options.enumname,
|
||||||
formatted_hdr_enums=built_hdr_enums,
|
formatted_hdr_enums=built_hdr_enums,
|
||||||
formatted_impl_enums=built_impl_enums,
|
formatted_impl_enums=built_impl_enums,
|
||||||
gen_structs=tlv_structs + subtype_structs,
|
gen_structs=subtype_structs + tlv_structs,
|
||||||
func_decls='\n'.join(decls)))
|
func_decls='\n'.join(decls)))
|
||||||
|
|||||||
Reference in New Issue
Block a user