mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pyln-client/gossmap: start internal function names with underscore _
This commit is contained in:
committed by
Rusty Russell
parent
de6c593272
commit
2bca76b6e9
@@ -99,7 +99,7 @@ class GossmapChannel(object):
|
|||||||
self.satoshis = None
|
self.satoshis = None
|
||||||
self.half_channels: List[Optional[GossmapHalfchannel]] = [None, None]
|
self.half_channels: List[Optional[GossmapHalfchannel]] = [None, None]
|
||||||
|
|
||||||
def update_channel(self,
|
def _update_channel(self,
|
||||||
direction: int,
|
direction: int,
|
||||||
fields: Dict[str, Any],
|
fields: Dict[str, Any],
|
||||||
off: int):
|
off: int):
|
||||||
@@ -182,7 +182,7 @@ class Gossmap(object):
|
|||||||
if len(n2.channels):
|
if len(n2.channels):
|
||||||
del self.nodes[c.node2_id]
|
del self.nodes[c.node2_id]
|
||||||
|
|
||||||
def add_channel(self, rec: bytes, off: int, is_private: bool):
|
def _add_channel(self, rec: bytes, off: int, is_private: bool):
|
||||||
fields = channel_announcement.read(io.BytesIO(rec[2:]), {})
|
fields = channel_announcement.read(io.BytesIO(rec[2:]), {})
|
||||||
# Add nodes one the fly
|
# Add nodes one the fly
|
||||||
node1_id = GossmapNodeId(fields['node_id_1'])
|
node1_id = GossmapNodeId(fields['node_id_1'])
|
||||||
@@ -213,13 +213,13 @@ class Gossmap(object):
|
|||||||
node_id = GossmapNodeId.from_str(node_id)
|
node_id = GossmapNodeId.from_str(node_id)
|
||||||
return self.nodes.get(cast(GossmapNodeId, node_id))
|
return self.nodes.get(cast(GossmapNodeId, node_id))
|
||||||
|
|
||||||
def update_channel(self, rec: bytes, off: int):
|
def _update_channel(self, rec: bytes, off: int):
|
||||||
fields = channel_update.read(io.BytesIO(rec[2:]), {})
|
fields = channel_update.read(io.BytesIO(rec[2:]), {})
|
||||||
direction = fields['channel_flags'] & 1
|
direction = fields['channel_flags'] & 1
|
||||||
c = self.channels[ShortChannelId.from_int(fields['short_channel_id'])]
|
c = self.channels[ShortChannelId.from_int(fields['short_channel_id'])]
|
||||||
c.update_channel(direction, fields, off)
|
c._update_channel(direction, fields, off)
|
||||||
|
|
||||||
def add_node_announcement(self, rec: bytes, off: int):
|
def _add_node_announcement(self, rec: bytes, off: int):
|
||||||
fields = node_announcement.read(io.BytesIO(rec[2:]), {})
|
fields = node_announcement.read(io.BytesIO(rec[2:]), {})
|
||||||
node_id = GossmapNodeId(fields['node_id'])
|
node_id = GossmapNodeId(fields['node_id'])
|
||||||
self.nodes[node_id].announce_fields = fields
|
self.nodes[node_id].announce_fields = fields
|
||||||
@@ -229,7 +229,7 @@ class Gossmap(object):
|
|||||||
"""FIXME: Implement!"""
|
"""FIXME: Implement!"""
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
def remove_channel_by_deletemsg(self, rec: bytes):
|
def _remove_channel_by_deletemsg(self, rec: bytes):
|
||||||
scid, = struct.unpack(">Q", rec[2:])
|
scid, = struct.unpack(">Q", rec[2:])
|
||||||
# It might have already been deleted when we skipped it.
|
# It might have already been deleted when we skipped it.
|
||||||
if scid in self.channels:
|
if scid in self.channels:
|
||||||
@@ -271,19 +271,19 @@ class Gossmap(object):
|
|||||||
|
|
||||||
rectype, = struct.unpack(">H", rec[:2])
|
rectype, = struct.unpack(">H", rec[:2])
|
||||||
if rectype == channel_announcement.number:
|
if rectype == channel_announcement.number:
|
||||||
self.add_channel(rec, off, False)
|
self._add_channel(rec, off, False)
|
||||||
elif rectype == WIRE_GOSSIP_STORE_PRIVATE_CHANNEL:
|
elif rectype == WIRE_GOSSIP_STORE_PRIVATE_CHANNEL:
|
||||||
self.add_channel(rec[2 + 8 + 2:], off + 2 + 8 + 2, True)
|
self._add_channel(rec[2 + 8 + 2:], off + 2 + 8 + 2, True)
|
||||||
elif rectype == WIRE_GOSSIP_STORE_CHANNEL_AMOUNT:
|
elif rectype == WIRE_GOSSIP_STORE_CHANNEL_AMOUNT:
|
||||||
self._set_channel_amount(rec)
|
self._set_channel_amount(rec)
|
||||||
elif rectype == channel_update.number:
|
elif rectype == channel_update.number:
|
||||||
self.update_channel(rec, off)
|
self._update_channel(rec, off)
|
||||||
elif rectype == WIRE_GOSSIP_STORE_PRIVATE_UPDATE:
|
elif rectype == WIRE_GOSSIP_STORE_PRIVATE_UPDATE:
|
||||||
self.update_channel(rec[2 + 2:], off + 2 + 2)
|
self._update_channel(rec[2 + 2:], off + 2 + 2)
|
||||||
elif rectype == WIRE_GOSSIP_STORE_DELETE_CHAN:
|
elif rectype == WIRE_GOSSIP_STORE_DELETE_CHAN:
|
||||||
self.remove_channel_by_deletemsg(rec)
|
self._remove_channel_by_deletemsg(rec)
|
||||||
elif rectype == node_announcement.number:
|
elif rectype == node_announcement.number:
|
||||||
self.add_node_announcement(rec, off)
|
self._add_node_announcement(rec, off)
|
||||||
elif rectype == WIRE_GOSSIP_STORE_ENDED:
|
elif rectype == WIRE_GOSSIP_STORE_ENDED:
|
||||||
self.reopen_store()
|
self.reopen_store()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user