diff --git a/electrum/lnmsg.py b/electrum/lnmsg.py index eeb83af50..e8ad41d24 100644 --- a/electrum/lnmsg.py +++ b/electrum/lnmsg.py @@ -323,7 +323,7 @@ def _parse_msgtype_intvalue_for_onion_wire(value: str) -> int: class LNSerializer: - def __init__(self, *, for_onion_wire: bool = False): + def __init__(self, *, name: str = 'peer_wire'): # TODO msg_type could be 'int' everywhere... self.msg_scheme_from_type = {} # type: Dict[bytes, List[Sequence[str]]] self.msg_type_from_name = {} # type: Dict[str, bytes] @@ -334,10 +334,7 @@ class LNSerializer: self.subtypes = {} # type: Dict[str, Dict[str, Sequence[str]]] - if for_onion_wire: - path = os.path.join(os.path.dirname(__file__), "lnwire", "onion_wire.csv") - else: - path = os.path.join(os.path.dirname(__file__), "lnwire", "peer_wire.csv") + path = os.path.join(os.path.dirname(__file__), "lnwire", name + ".csv") with open(path, newline='') as f: csvreader = csv.reader(f) for row in csvreader: @@ -345,7 +342,7 @@ class LNSerializer: if row[0] == "msgtype": # msgtype,,[,