1
0

Do not route through channels for which we did not receive

both updates, because this often means one of the nodes is
offline.
This commit is contained in:
ThomasV
2019-07-13 08:46:17 +02:00
parent 30e942bead
commit b55f9e9e6a
3 changed files with 20 additions and 3 deletions

View File

@@ -129,6 +129,10 @@ class LNPathFinder(Logger):
self.channel_db = channel_db
self.blacklist = set()
def add_to_blacklist(self, short_channel_id):
self.logger.info(f'blacklisting channel {bh2u(short_channel_id)}')
self.blacklist.add(short_channel_id)
def _edge_cost(self, short_channel_id: bytes, start_node: bytes, end_node: bytes,
payment_amt_msat: int, ignore_costs=False) -> Tuple[float, int]:
"""Heuristic cost of going through a channel.
@@ -140,7 +144,11 @@ class LNPathFinder(Logger):
channel_policy = self.channel_db.get_policy_for_node(short_channel_id, start_node)
if channel_policy is None:
return float('inf'), 0
if channel_policy.is_disabled(): return float('inf'), 0
# channels that did not publish both policies often return temporary channel failure
if self.channel_db.get_policy_for_node(short_channel_id, end_node) is None:
return float('inf'), 0
if channel_policy.is_disabled():
return float('inf'), 0
route_edge = RouteEdge.from_channel_policy(channel_policy, short_channel_id, end_node)
if payment_amt_msat < channel_policy.htlc_minimum_msat:
return float('inf'), 0 # payment amount too little