From c61aef2da37d485ea53c93e453e3c1c5aa139289 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 8 May 2024 19:41:17 +0800 Subject: [PATCH] fix: simplify if statements --- src/node/waku_node.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/node/waku_node.py b/src/node/waku_node.py index 92659dc6..44985ae4 100644 --- a/src/node/waku_node.py +++ b/src/node/waku_node.py @@ -193,17 +193,17 @@ class WakuNode: if self.health_response == b"Node is healthy": logger.info("Node is healthy !!") return - else: - try: - self.health_response = json.loads(self.health_response) - except Exception as ex: - raise AttributeError(f"Unknown health response format {ex}") - if self.health_response["nodeHealth"] and self.health_response["nodeHealth"] != "Ready": + try: + self.health_response = json.loads(self.health_response) + except Exception as ex: + raise AttributeError(f"Unknown health response format {ex}") + + if self.health_response.get("nodeHealth") != "Ready": raise AssertionError("Waiting for the node health status: Ready") - for p in self.health_response["protocolsHealth"]: - if p["Rln Relay"] and p["Rln Relay"] != "Ready": + for p in self.health_response.get("protocolsHealth"): + if p.get("Rln Relay") != "Ready": raise AssertionError("Waiting for the Rln relay status: Ready") logger.info("Node protocols are initialized !!")