From 49299725e01b4273d2cbc12c96d0f21166e7b144 Mon Sep 17 00:00:00 2001 From: g-homebase Date: Thu, 28 Nov 2019 14:19:50 -0500 Subject: [PATCH] Fix watching errors --- proxy_docker/app/script/walletoperations.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/proxy_docker/app/script/walletoperations.sh b/proxy_docker/app/script/walletoperations.sh index 295fbe6..cdc54ab 100644 --- a/proxy_docker/app/script/walletoperations.sh +++ b/proxy_docker/app/script/walletoperations.sh @@ -167,17 +167,15 @@ getbalancebyxpub() { data="{\"method\":\"getaddressesbylabel\",\"params\":[\"${xpub}\"]}" trace "[getbalancebyxpub] data=${data}" addresses=$(send_to_xpub_watcher_wallet ${data} | jq ".result | keys" | tr -d '\n ') - # ./bitcoin-cli -rpcwallet=xpubwatching01.dat listunspent 0 9999999 "$addresses" | jq "[.[].amount] | add" - - data="{\"method\":\"listunspent\",\"params\":[0,9999999,\"${addresses}\"]}" + data="{\"method\":\"listunspent\",\"params\":[0,9999999,${addresses}]}" trace "[getbalancebyxpub] data=${data}" - balance=$(send_to_xpub_watcher_wallet ${data} | jq "[.result[].amount] | add | . * 100000000 | trunc | . / 100000000") + balance=$(send_to_xpub_watcher_wallet ${data} | jq "[.result[].amount // 0 ] | add | . * 100000000 | trunc | . / 100000000") returncode=$? trace_rc ${returncode} trace "[getbalancebyxpub] balance=${balance}" - data="{\"event\":\"${event}\",\"xpub\":\"${xpub}\",\"balance\":${balance}}" + data="{\"event\":\"${event}\",\"xpub\":\"${xpub}\",\"balance\":${balance:-0}}" echo "${data}"