From abacb0702bdc4f2f21bdae3d7bd0aaa03e4e9496 Mon Sep 17 00:00:00 2001
From: Alex Gartner <git@agartner.com>
Date: Thu, 21 Nov 2024 20:15:30 +0000
Subject: [PATCH] fix wallet name

---
 wallet-health.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/wallet-health.sh b/wallet-health.sh
index 4ac668c..c9e4a10 100755
--- a/wallet-health.sh
+++ b/wallet-health.sh
@@ -2,10 +2,15 @@
 
 set -eo pipefail
 
+wallet_name=default
+if [[ -n $1 ]]; then
+  wallet_name=$1
+fi
+
 # this script checks if a wallet exists and is not scanning
 
 echo "Getting wallet info"
-wallet_info=$(bitcoin-cli -rpcwallet=$1 getwalletinfo)
+wallet_info=$(bitcoin-cli -rpcwallet=${wallet_name} getwalletinfo)
 
 if [[ $(echo "$wallet_info" | jq -r '.scanning') == "true" ]]; then
   echo "Error: Wallet is currently scanning" >&2