fix typo
This commit is contained in:
@@ -227,7 +227,7 @@ class Peer(Logger):
|
|||||||
their_globalfeatures = int.from_bytes(payload['globalfeatures'], byteorder="big")
|
their_globalfeatures = int.from_bytes(payload['globalfeatures'], byteorder="big")
|
||||||
self.their_features |= their_globalfeatures
|
self.their_features |= their_globalfeatures
|
||||||
# check transitive dependencies for received features
|
# check transitive dependencies for received features
|
||||||
if not self.their_features.validate_transitive_dependecies():
|
if not self.their_features.validate_transitive_dependencies():
|
||||||
raise GracefulDisconnect("remote did not set all dependencies for the features they sent")
|
raise GracefulDisconnect("remote did not set all dependencies for the features they sent")
|
||||||
# check if features are compatible, and set self.features to what we negotiated
|
# check if features are compatible, and set self.features to what we negotiated
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -963,7 +963,7 @@ class LnFeatures(IntFlag):
|
|||||||
_ln_feature_contexts[OPTION_SUPPORT_LARGE_CHANNEL_OPT] = (LNFC.INIT | LNFC.NODE_ANN | LNFC.CHAN_ANN_ALWAYS_EVEN)
|
_ln_feature_contexts[OPTION_SUPPORT_LARGE_CHANNEL_OPT] = (LNFC.INIT | LNFC.NODE_ANN | LNFC.CHAN_ANN_ALWAYS_EVEN)
|
||||||
_ln_feature_contexts[OPTION_SUPPORT_LARGE_CHANNEL_REQ] = (LNFC.INIT | LNFC.NODE_ANN | LNFC.CHAN_ANN_ALWAYS_EVEN)
|
_ln_feature_contexts[OPTION_SUPPORT_LARGE_CHANNEL_REQ] = (LNFC.INIT | LNFC.NODE_ANN | LNFC.CHAN_ANN_ALWAYS_EVEN)
|
||||||
|
|
||||||
def validate_transitive_dependecies(self) -> bool:
|
def validate_transitive_dependencies(self) -> bool:
|
||||||
# for all even bit set, set corresponding odd bit:
|
# for all even bit set, set corresponding odd bit:
|
||||||
features = self # copy
|
features = self # copy
|
||||||
flags = list_enabled_bits(features)
|
flags = list_enabled_bits(features)
|
||||||
@@ -1087,7 +1087,7 @@ def validate_features(features: int) -> None:
|
|||||||
for fbit in enabled_features:
|
for fbit in enabled_features:
|
||||||
if (1 << fbit) & LN_FEATURES_IMPLEMENTED == 0 and fbit % 2 == 0:
|
if (1 << fbit) & LN_FEATURES_IMPLEMENTED == 0 and fbit % 2 == 0:
|
||||||
raise UnknownEvenFeatureBits(fbit)
|
raise UnknownEvenFeatureBits(fbit)
|
||||||
if not features.validate_transitive_dependecies():
|
if not features.validate_transitive_dependencies():
|
||||||
raise IncompatibleOrInsaneFeatures(f"not all transitive dependencies are set. "
|
raise IncompatibleOrInsaneFeatures(f"not all transitive dependencies are set. "
|
||||||
f"features={features}")
|
f"features={features}")
|
||||||
|
|
||||||
|
|||||||
@@ -757,21 +757,21 @@ class TestLNUtil(ElectrumTestCase):
|
|||||||
extract_nodeid("00" * 33 + "@")
|
extract_nodeid("00" * 33 + "@")
|
||||||
self.assertEqual(extract_nodeid("00" * 33 + "@localhost"), (b"\x00" * 33, "localhost"))
|
self.assertEqual(extract_nodeid("00" * 33 + "@localhost"), (b"\x00" * 33, "localhost"))
|
||||||
|
|
||||||
def test_ln_features_validate_transitive_dependecies(self):
|
def test_ln_features_validate_transitive_dependencies(self):
|
||||||
features = LnFeatures.OPTION_DATA_LOSS_PROTECT_REQ
|
features = LnFeatures.OPTION_DATA_LOSS_PROTECT_REQ
|
||||||
self.assertTrue(features.validate_transitive_dependecies())
|
self.assertTrue(features.validate_transitive_dependencies())
|
||||||
features = LnFeatures.PAYMENT_SECRET_OPT
|
features = LnFeatures.PAYMENT_SECRET_OPT
|
||||||
self.assertFalse(features.validate_transitive_dependecies())
|
self.assertFalse(features.validate_transitive_dependencies())
|
||||||
features = LnFeatures.PAYMENT_SECRET_REQ
|
features = LnFeatures.PAYMENT_SECRET_REQ
|
||||||
self.assertFalse(features.validate_transitive_dependecies())
|
self.assertFalse(features.validate_transitive_dependencies())
|
||||||
features = LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_REQ
|
features = LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_REQ
|
||||||
self.assertTrue(features.validate_transitive_dependecies())
|
self.assertTrue(features.validate_transitive_dependencies())
|
||||||
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ
|
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ
|
||||||
self.assertFalse(features.validate_transitive_dependecies())
|
self.assertFalse(features.validate_transitive_dependencies())
|
||||||
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_OPT
|
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_OPT
|
||||||
self.assertTrue(features.validate_transitive_dependecies())
|
self.assertTrue(features.validate_transitive_dependencies())
|
||||||
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_REQ
|
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_REQ
|
||||||
self.assertTrue(features.validate_transitive_dependecies())
|
self.assertTrue(features.validate_transitive_dependencies())
|
||||||
|
|
||||||
def test_ln_features_for_init_message(self):
|
def test_ln_features_for_init_message(self):
|
||||||
features = LnFeatures.OPTION_DATA_LOSS_PROTECT_REQ
|
features = LnFeatures.OPTION_DATA_LOSS_PROTECT_REQ
|
||||||
|
|||||||
Reference in New Issue
Block a user