lnrouter+lnworker: use liquidity hints
Adds liquidity hints for the sending capabilities of routing channels in the graph. The channel blacklist is incorporated into liquidity hints. Liquidity hints are updated when a payment fails with a temporary channel failure or when it succeeds. Liquidity hints are used to give a penalty in the _edge_cost heuristics used by the pathfinding algorithm. The base penalty in (_edge_cost) is removed because it is now part of the liquidity penalty. We don't return early from get_distances, as we want to explore all channels.
This commit is contained in:
@@ -1354,16 +1354,3 @@ class OnionFailureCodeMetaFlag(IntFlag):
|
||||
UPDATE = 0x1000
|
||||
|
||||
|
||||
class ChannelBlackList:
|
||||
|
||||
def __init__(self):
|
||||
self.blacklist = dict() # short_chan_id -> timestamp
|
||||
|
||||
def add(self, short_channel_id: ShortChannelID):
|
||||
now = int(time.time())
|
||||
self.blacklist[short_channel_id] = now
|
||||
|
||||
def get_current_list(self) -> Set[ShortChannelID]:
|
||||
BLACKLIST_DURATION = 3600
|
||||
now = int(time.time())
|
||||
return set(k for k, t in self.blacklist.items() if now - t < BLACKLIST_DURATION)
|
||||
|
||||
Reference in New Issue
Block a user