From e8306f8a8ae3750ae58acced1ee3e2186576af63 Mon Sep 17 00:00:00 2001 From: g-homebase Date: Thu, 12 Dec 2019 19:39:13 -0500 Subject: [PATCH] Fix issue #153 --- proxy_docker/app/script/confirmation.sh | 6 ++++-- proxy_docker/app/script/getactivewatches.sh | 5 +++-- proxy_docker/app/script/walletoperations.sh | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/proxy_docker/app/script/confirmation.sh b/proxy_docker/app/script/confirmation.sh index 3fbfd8a..d0dd606 100644 --- a/proxy_docker/app/script/confirmation.sh +++ b/proxy_docker/app/script/confirmation.sh @@ -30,7 +30,9 @@ confirmation() { local returncode local txid=${1} local tx_details - tx_details=$(get_transaction ${txid}) + # We need make sure to discard error results generated by get_transction tryin to find a watching wallet's `txn in + # spender wallet first,return code will tell if there's an actaul error. FIXME Add issue here + tx_details=$(get_transaction ${txid} | jq '. | select(.result != null)') returncode=$? trace_rc ${returncode} trace "[confirmation] tx_details=${tx_details}" @@ -68,7 +70,7 @@ confirmation() { local tx=$(sql "SELECT id FROM tx WHERE txid=\"${txid}\"") local id_inserted local tx_raw_details=$(get_rawtransaction ${txid}) - local tx_nb_conf=$(echo "${tx_details}" | jq '.result.confirmations') + local tx_nb_conf=$(echo "${tx_details}" | jq -r '.result.confirmations // 0') # Sometimes raw tx are too long to be passed as paramater, so let's write # it to a temp file for it to be read by sqlite3 and then delete the file diff --git a/proxy_docker/app/script/getactivewatches.sh b/proxy_docker/app/script/getactivewatches.sh index 7b0a0bb..b62ca04 100644 --- a/proxy_docker/app/script/getactivewatches.sh +++ b/proxy_docker/app/script/getactivewatches.sh @@ -38,9 +38,10 @@ get_unused_addresses_by_watchlabel(){ FROM watching as w INNER JOIN watching_by_pub32 AS w32 ON w.watching_by_pub32_id = w32.id WHERE w32.label="$1" - AND w.id NOT IN ( - SELECT watching_id FROM watching_tx + AND NOT EXISTS ( + SELECT 1 FROM watching_tx WHERE watching_id = w.id ) + ORDER BY w.pub32_index ASC HERE ) label_unused_addrs=$(sql "$query") diff --git a/proxy_docker/app/script/walletoperations.sh b/proxy_docker/app/script/walletoperations.sh index 404a7b8..0fd45be 100644 --- a/proxy_docker/app/script/walletoperations.sh +++ b/proxy_docker/app/script/walletoperations.sh @@ -197,7 +197,7 @@ getbalancebyxpub() { echo "${data}" - return ${returncode} + return "${returncode}" } getnewaddress() {