mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
pyln.proto.message: support adding two namespaces.
They must not have duplicate names! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
85bb93618b
commit
8f38bc7230
@ -21,6 +21,19 @@ domain, such as within a given BOLT"""
|
||||
|
||||
self.load_csv(csv_lines)
|
||||
|
||||
def __add__(self, other):
|
||||
ret = MessageNamespace()
|
||||
ret.subtypes = self.subtypes.copy()
|
||||
for v in other.subtypes.values():
|
||||
ret.add_subtype(v)
|
||||
ret.tlvtypes = self.tlvtypes.copy()
|
||||
for v in other.tlvtypes.values():
|
||||
ret.add_tlvtype(v)
|
||||
ret.messagetypes = self.messagetypes.copy()
|
||||
for v in other.messagetypes.values():
|
||||
ret.add_messagetype(v)
|
||||
return ret
|
||||
|
||||
def add_subtype(self, t):
|
||||
prev = self.get_type(t.name)
|
||||
if prev:
|
||||
|
Loading…
Reference in New Issue
Block a user