From 7cb394e2000fc498541ce2bd72cfed11b4df72e5 Mon Sep 17 00:00:00 2001 From: Matthew Zipkin Date: Wed, 30 Jul 2025 10:44:46 -0400 Subject: [PATCH] lnd newaddress: try/catch in case of JSON error --- resources/scenarios/ln_framework/ln.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/resources/scenarios/ln_framework/ln.py b/resources/scenarios/ln_framework/ln.py index f2ec4cbc2..7a281e676 100644 --- a/resources/scenarios/ln_framework/ln.py +++ b/resources/scenarios/ln_framework/ln.py @@ -430,12 +430,17 @@ def newaddress(self, max_tries=10): while attempt < max_tries: attempt += 1 response = self.get("/v1/newaddress") - res = json.loads(response) - if "address" in res: - return True, res["address"] - else: + try: + res = json.loads(response) + if "address" in res: + return True, res["address"] + else: + self.log.warning( + f"Couldn't get wallet address from {self.name}:\n {res}\n wait and retry..." + ) + except Exception: self.log.warning( - f"Couldn't get wallet address from {self.name}:\n {res}\n wait and retry..." + f"Couldn't decode newaddress JSON from {self.name}:\n {response}\n wait and retry..." ) sleep(1) return False, ""