Browse Source

bolt-gen: remove 'is-optional' qualifier from msg field

we now handle optional fields, so we should include them in
the message parsing signatures
pull/2938/head
lisa neigut 6 years ago
committed by Rusty Russell
parent
commit
f2819ba7d8
  1. 4
      tools/gen/header_template
  2. 2
      tools/gen/impl_template

4
tools/gen/header_template

@ -79,8 +79,8 @@ void fromwire_${subtype.name}(const u8 **cursor, size_t *plen, ${subtype.type_na
% for c in msg.msg_comments: % for c in msg.msg_comments:
/* ${c} */ /* ${c} */
% endfor % endfor
u8 *towire_${msg.name}(const tal_t *ctx${''.join([f.arg_desc_to() for f in msg.fields.values() if not f.is_optional])}); u8 *towire_${msg.name}(const tal_t *ctx${''.join([f.arg_desc_to() for f in msg.fields.values()])});
bool fromwire_${msg.name}(${'const tal_t *ctx, ' if msg.has_len_fields() else ''}const void *p${''.join([f.arg_desc_from() for f in msg.fields.values() if not f.is_optional])}); bool fromwire_${msg.name}(${'const tal_t *ctx, ' if msg.needs_context() else ''}const void *p${''.join([f.arg_desc_from() for f in msg.fields.values()])});
% endfor % endfor
#endif /* LIGHTNING_${idem} */ #endif /* LIGHTNING_${idem} */

2
tools/gen/impl_template

@ -144,7 +144,7 @@ fromwire_${type_}(${'ctx, ' if f.needs_context() else ''}&cursor, &plen, ${'*' i
% for c in msg.msg_comments: % for c in msg.msg_comments:
/* ${c} */ /* ${c} */
% endfor % endfor
u8 *towire_${msg.name}(const tal_t *ctx${''.join([f.arg_desc_to() for f in msg.fields.values() if not f.is_optional])}) u8 *towire_${msg.name}(const tal_t *ctx${''.join([f.arg_desc_to() for f in msg.fields.values()])})
{ {
## FIXME: we're ignoring TLV's rn ## FIXME: we're ignoring TLV's rn
% for f in msg.get_len_fields(): % for f in msg.get_len_fields():

Loading…
Cancel
Save