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