lnutil: make LnFeatures.supports() faster
LnFeatures.supports() is became part of the hot path of
LNPathFinder.find_path_for_payment()
in 6b43eac6fd,
which made find_path_for_payment considerably slower than before.
It used to take around 0.8 sec originally, then after linked commit went to ~9 sec,
and now this takes it down to ~1.1 sec (on my laptop).
This commit is contained in:
@@ -493,7 +493,7 @@ class LNPathFinder(Logger):
|
||||
# it's ok if we are missing the node_announcement (node_info) for this node,
|
||||
# but if we have it, we enforce that they support var_onion_optin
|
||||
node_features = LnFeatures(node_info.features)
|
||||
if not node_features.supports(LnFeatures.VAR_ONION_OPT):
|
||||
if not node_features.supports(LnFeatures.VAR_ONION_OPT): # note: this is kind of slow. could be cached.
|
||||
return float('inf'), 0
|
||||
route_edge = RouteEdge.from_channel_policy(
|
||||
channel_policy=channel_policy,
|
||||
|
||||
Reference in New Issue
Block a user