1
0

lnutil.LnFeatures: impl and use "supports" method for feature-bit-tests

Note that for a required feature, BOLT-09 allows setting either:
- only the REQ bit
- both the REQ bit and the OPT bit

Hence, when checking if a feature is supported by e.g. an invoice, both
bits should be checked.

Note that in lnpeer.py, in self.features specifically, REQ implies OPT,
as it is set by ln_compare_features.
This commit is contained in:
SomberNight
2021-02-22 19:53:01 +01:00
parent 0369829e5e
commit 4aab843f17
5 changed files with 96 additions and 12 deletions

View File

@@ -96,8 +96,8 @@ class RouteEdge(PathEdge):
return True
def has_feature_varonion(self) -> bool:
features = self.node_features
return bool(features & LnFeatures.VAR_ONION_REQ or features & LnFeatures.VAR_ONION_OPT)
features = LnFeatures(self.node_features)
return features.supports(LnFeatures.VAR_ONION_OPT)
def is_trampoline(self):
return False