From c0313e83111de2719f3b6eaaca2b3bf2b75a7d3f Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Mon, 21 Sep 2020 15:31:41 -0700 Subject: [PATCH] Handle invalid node cert during node validation --- nucypher/network/nodes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nucypher/network/nodes.py b/nucypher/network/nodes.py index 3ff63155e..530aa615f 100644 --- a/nucypher/network/nodes.py +++ b/nucypher/network/nodes.py @@ -397,7 +397,10 @@ class Learner: stranger_certificate = node.certificate # Store node's certificate - It has been seen. - certificate_filepath = self.node_storage.store_node_certificate(certificate=stranger_certificate) + try: + certificate_filepath = self.node_storage.store_node_certificate(certificate=stranger_certificate) + except InvalidNodeCertificate: + return False # that was easy # In some cases (seed nodes or other temp stored certs), # this will update the filepath from the temp location to this one.