From ab5c8f8e1fb3f0050ca355bfcdd0e9d4dbb1ecf6 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Fri, 14 Jan 2022 09:13:57 +0100 Subject: [PATCH] ignore missing edges when ignoring channels fixes #252 --- lnd.py | 2 +- routes.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lnd.py b/lnd.py index 2d5b65f..b76ce5c 100644 --- a/lnd.py +++ b/lnd.py @@ -140,7 +140,7 @@ def get_route( def get_edge(self, channel_id): try: return self.stub.GetChanInfo(ln.ChanInfoRequest(chan_id=channel_id)) - except: + except Exception: print(f"Unable to find channel edge {channel_id}") raise diff --git a/routes.py b/routes.py index b5b4c80..3bb2b36 100644 --- a/routes.py +++ b/routes.py @@ -129,7 +129,10 @@ def ignore_high_fee_hops(self, route): self.ignore_hop_on_route(hop, route) def ignore_channel(self, chan_id): - edge = self.lnd.get_edge(chan_id) + try: + edge = self.lnd.get_edge(chan_id) + except Exception: + return self.ignore_edge_from_to(chan_id, edge.node1_pub, edge.node2_pub) self.ignore_edge_from_to(chan_id, edge.node2_pub, edge.node1_pub)