tchannel_db: update channels_for_node when removing channel - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 32fcad5bc3bd36d376ecf650633dd65af361e0b1 DIR parent 2be68ac4d2e074ed3e50eb754ce12d06c88e9745 HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 4 Jul 2019 10:50:23 +0200 channel_db: update channels_for_node when removing channel Diffstat: M electrum/channel_db.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- DIR diff --git a/electrum/channel_db.py b/electrum/channel_db.py t@@ -477,7 +477,7 @@ class ChannelDB(SqlDB): def prune_orphaned_channels(self): l = self.get_orphaned_channels() for k in l: - self._channels.pop(k) + self.remove_channel(k) self.update_counts() if l: self.logger.info(f'Deleting {len(l)} orphaned channels') t@@ -490,7 +490,10 @@ class ChannelDB(SqlDB): self._channel_updates_for_private_channels[(start_node_id, short_channel_id)] = msg_payload def remove_channel(self, short_channel_id): - self._channels.pop(short_channel_id, None) + channel_info = self._channels.pop(short_channel_id, None) + if channel_info: + self._channels_for_node[channel_info.node1_id].remove(channel_info.short_channel_id) + self._channels_for_node[channel_info.node2_id].remove(channel_info.short_channel_id) def get_node_addresses(self, node_id): return self._addresses.get(node_id)