From e8a10b019d90501e8a9cf3d54dd5db4c0610b240 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Wed, 27 Mar 2019 19:00:25 -0700 Subject: [PATCH] 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 --- tools/generate-wire.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/generate-wire.py b/tools/generate-wire.py index ca5d3bdb4..97ceed393 100755 --- a/tools/generate-wire.py +++ b/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