Browse Source

bolt-gen: use ordered-dict for fields

Use ordered dict for fields, who's order matters when iterated
through (especially for argument lists).

Reported-By: @mocacinno
pull/2938/head
lisa neigut 6 years ago
committed by Rusty Russell
parent
commit
1044e37fee
  1. 3
      tools/generate-bolts.py

3
tools/generate-bolts.py

@ -18,6 +18,7 @@
# subtypedata,<subtypename>,<fieldname>,<typename>,[<count>] # subtypedata,<subtypename>,<fieldname>,<typename>,[<count>]
from argparse import ArgumentParser, REMAINDER from argparse import ArgumentParser, REMAINDER
from collections import OrderedDict
import copy import copy
import fileinput import fileinput
from mako.template import Template from mako.template import Template
@ -98,7 +99,7 @@ class Field(object):
class FieldSet(object): class FieldSet(object):
def __init__(self): def __init__(self):
self.fields = {} self.fields = OrderedDict()
self.optional_fields = False self.optional_fields = False
self.len_fields = {} self.len_fields = {}

Loading…
Cancel
Save