delete channel from db in remove_channel, becaose it is called from lnworker

This commit is contained in:
ThomasV 2019-10-23 08:20:15 +02:00
parent 9fbac40d56
commit a4944cdcb2
2 changed files with 3 additions and 1 deletions

View file

@ -508,7 +508,6 @@ class ChannelDB(SqlDB):
if l:
for short_channel_id in l:
self.remove_channel(short_channel_id)
self.delete_channel(short_channel_id)
self.update_counts()
self.logger.info(f'Deleting {len(l)} orphaned channels')
@ -524,6 +523,8 @@ class ChannelDB(SqlDB):
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)
# delete from database
self.delete_channel(short_channel_id)
def get_node_addresses(self, node_id):
return self._addresses.get(node_id)

View file

@ -864,6 +864,7 @@ class LNWallet(LNWorker):
short_channel_id = route[0].short_channel_id
chan = self.get_channel_by_short_id(short_channel_id)
if not chan:
self.channel_db.remove_channel(short_channel_id)
raise Exception(f"PathFinder returned path with short_channel_id "
f"{short_channel_id} that is not in channel list")
self.set_payment_status(lnaddr.paymenthash, PR_INFLIGHT)