From 50f3f07b63359e9536ccc117de58a5327929f1a1 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 1 Feb 2024 23:26:57 +1100 Subject: [PATCH] fix: Check for node not being connected --- account.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index e5445f8..0b14571 100644 --- a/account.py +++ b/account.py @@ -87,7 +87,11 @@ def createWallet(account: str, password: str): def listWallets(): # List the wallets response = hsw.listWallets() - return response + + # Check if response is json or an array + if isinstance(response, list): + return response + return ['Wallet not connected'] def getBalance(account: str): # Get the total balance @@ -316,6 +320,9 @@ def setDNS(account,domain,records): def getNodeSync(): response = hsd.getInfo() + if 'error' in response: + return 0 + sync = response['chain']['progress']*100 sync = round(sync, 2) return sync