commit 8dfa8904287f4c0070848308e12101fae4bc3015 Author: Damian Johnson atagar@torproject.org Date: Fri Oct 25 14:52:54 2019 -0700
Match introduction points by index
We retain introduction point ordering so there's no need to iterate over the original to match. --- test/unit/descriptor/hidden_service_v3.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/test/unit/descriptor/hidden_service_v3.py b/test/unit/descriptor/hidden_service_v3.py index 203cd3c3..b57a3ebf 100644 --- a/test/unit/descriptor/hidden_service_v3.py +++ b/test/unit/descriptor/hidden_service_v3.py @@ -350,18 +350,13 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase): # descriptor and do some sanity checks between them to make sure that # parsing was done right!
- for desc_intro in inner_layer.introduction_points: - original_found = False # Make sure we found all the intro points + for i, desc_intro in enumerate(inner_layer.introduction_points): + original_intro = intro_points[i]
- for original_intro in intro_points: - # Match intro points + auth_key_1 = Ed25519PublicKey.from_public_bytes(desc_intro.auth_key_cert.key) + auth_key_2 = original_intro.auth_key
- auth_key_1 = Ed25519PublicKey.from_public_bytes(desc_intro.auth_key_cert.key) - auth_key_2 = original_intro.auth_key + self.assertTrue(_pubkeys_are_equal(desc_intro.enc_key(), original_intro.enc_key)) + self.assertTrue(_pubkeys_are_equal(desc_intro.onion_key(), original_intro.onion_key))
- if _pubkeys_are_equal(auth_key_1, auth_key_2): - original_found = True - self.assertTrue(_pubkeys_are_equal(desc_intro.enc_key(), original_intro.enc_key)) - self.assertTrue(_pubkeys_are_equal(desc_intro.onion_key(), original_intro.onion_key)) - - self.assertTrue(original_found) + self.assertTrue(_pubkeys_are_equal(auth_key_1, auth_key_2))