Browse Source

gen: move an error check to catch all instances of failure

`m` might not be set on the optional set as well, so move this check
down so that we now encompass both codepaths
pr-2587
lisa neigut 6 years ago
committed by Rusty Russell
parent
commit
e8a10b019d
  1. 4
      tools/generate-wire.py

4
tools/generate-wire.py

@ -1252,8 +1252,6 @@ for line in fileinput.input(options.files):
# eg commit_sig,0,channel-id,8 OR
# commit_sig,0,channel-id,u64
m = find_message(messages + subtypes, parts[0])
if m is None:
raise ValueError('Unknown message or subtype {}'.format(parts[0]))
elif len(parts) == 5:
# eg.
# channel_reestablish,48,your_last_per_commitment_secret,32,option209
@ -1261,6 +1259,8 @@ for line in fileinput.input(options.files):
else:
raise ValueError('Line {} malformed'.format(line.rstrip()))
if m is None:
raise ValueError('Unknown message or subtype {}'.format(parts[0]))
f = Field(m.name, parts[2], parts[3], comments, prevfield, includes)
m.addField(f)
# If it used prevfield as lenvar, keep that for next

Loading…
Cancel
Save