Skip to content

Commit

Permalink
gen: move an error check to catch all instances of failure
Browse files Browse the repository at this point in the history
`m` might not be set on the optional set as well, so move this check
down so that we now encompass both codepaths
  • Loading branch information
niftynei authored and rustyrussell committed Apr 10, 2019
1 parent 48078f7 commit e8a10b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/generate-wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,15 +1252,15 @@ def find_message_with_option(messages, optional_messages, name, option):
# 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
m = find_message_with_option(messages, messages_with_option, parts[0], parts[4])
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
Expand Down

0 comments on commit e8a10b0

Please sign in to comment.