diff --git a/proxy_docker/app/script/getactivewatches.sh b/proxy_docker/app/script/getactivewatches.sh index c401244..4725c1d 100644 --- a/proxy_docker/app/script/getactivewatches.sh +++ b/proxy_docker/app/script/getactivewatches.sh @@ -7,17 +7,12 @@ getactivewatches() { trace "Entering getactivewatches()..." local watches - watches=$(sql "SELECT id, address, imported, callback0conf, callback1conf, inserted_ts FROM watching WHERE watching AND NOT calledback1conf") + # Let's build the string directly with sqlite instead of manipulating multiple strings afterwards, it's faster. + # {"id":"${id}","address":"${address}","imported":"${imported}","unconfirmedCallbackURL":"${cb0conf_url}","confirmedCallbackURL":"${cb1conf_url}","watching_since":"${timestamp}"} + watches=$(sql "SELECT '{\"id\":\"' || id || '\",\"address\":\"' || address || '\",\"imported\":\"' || imported || '\",\"unconfirmedCallbackURL\":\"' || callback0conf || '\",\"confirmedCallbackURL\":\"' || callback1conf || '\",\"watching_since\":\"' || inserted_ts || '\"}' FROM watching WHERE watching AND NOT calledback1conf") returncode=$? trace_rc ${returncode} - local id - local address - local imported - local inserted - local cb0conf_url - local cb1conf_url - local timestamp local notfirst=false echo -n "{\"watches\":[" @@ -31,28 +26,8 @@ getactivewatches() { notfirst=true fi trace "[getactivewatches] row=${row}" - id=$(echo "${row}" | cut -d '|' -f1) - trace "[getactivewatches] id=${id}" - address=$(echo "${row}" | cut -d '|' -f2) - trace "[getactivewatches] address=${address}" - imported=$(echo "${row}" | cut -d '|' -f3) - trace "[getactivewatches] imported=${imported}" - cb0conf_url=$(echo "${row}" | cut -d '|' -f4) - trace "[getactivewatches] cb0conf_url=${cb0conf_url}" - cb1conf_url=$(echo "${row}" | cut -d '|' -f5) - trace "[getactivewatches] cb1conf_url=${cb1conf_url}" - timestamp=$(echo "${row}" | cut -d '|' -f6) - trace "[getactivewatches] timestamp=${timestamp}" - data="{\"id\":\"${id}\"," - data="${data}\"address\":\"${address}\"," - data="${data}\"imported\":\"${imported}\"," - data="${data}\"unconfirmedCallbackURL\":\"${cb0conf_url}\"," - data="${data}\"confirmedCallbackURL\":\"${cb1conf_url}\"," - data="${data}\"watching_since\":\"${timestamp}\"}" - trace "[getactivewatches] data=${data}" - - echo -n "${data}" + echo -n "${row}" done echo "]}" diff --git a/proxy_docker/app/script/importaddress.sh b/proxy_docker/app/script/importaddress.sh index 521a2fc..ea3b619 100644 --- a/proxy_docker/app/script/importaddress.sh +++ b/proxy_docker/app/script/importaddress.sh @@ -23,7 +23,7 @@ importmulti_rpc() { local walletname=${1} local label=${2} local addresses=$(echo "${3}" | jq ".addresses" | tr -d '\n ') - trace "[importmulti_rpc] addresses=${addresses}" +# trace "[importmulti_rpc] addresses=${addresses}" # Will look like: # [{"address":"2N6Q9kBcLtNswgMSLSQ5oduhbctk7hxEJW8"},{"address":"2NFLhFghAPKEPuZCKoeXYYxuaBxhKXbmhBV"},{"address":"2N7gepbQtRM5Hm4PTjvGadj9wAwEwnAsKiP"}] @@ -35,12 +35,12 @@ importmulti_rpc() { # {"scriptPubKey":{"address":"2N6Q9kBcLtNswgMSLSQ5oduhbctk7hxEJW8"},"timestamp":"now","watchonly":true,"label":"xpub"}, addresses=$(echo "${addresses}" | sed "s/\"address\"/\"scriptPubKey\":\{\"address\"/g" | sed "s/}/},\"timestamp\":\"now\",\"watchonly\":true,\"label\":\"${label}\"}/g") - trace "[importmulti_rpc] addresses=${addresses}" +# trace "[importmulti_rpc] addresses=${addresses}" # Now we use that in the RPC string local rpcstring="{\"method\":\"importmulti\",\"params\":[${addresses},{\"rescan\":false}]}" - trace "[importmulti_rpc] rpcstring=${rpcstring}" +# trace "[importmulti_rpc] rpcstring=${rpcstring}" local result result=$(send_to_watcher_node_wallet ${walletname} ${rpcstring}) diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh index c64397f..c2ced2c 100644 --- a/proxy_docker/app/script/requesthandler.sh +++ b/proxy_docker/app/script/requesthandler.sh @@ -212,7 +212,6 @@ main() # BODY {"pub32":"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb","path":"0/25-30"} # BODY {"pub32":"vpub5SLqN2bLY4WeZF3kL4VqiWF1itbf3A6oRrq9aPf16AZMVWYCuN9TxpAZwCzVgW94TNzZPNc9XAHD4As6pdnExBtCDGYRmNJrcJ4eV9hNqcv","path":"0/25-30"} -# response=$(send_to_pycoin "${line}") response=$(derivepubpath "${line}") response_to_client "${response}" ${?} break diff --git a/proxy_docker/app/script/watchrequest.sh b/proxy_docker/app/script/watchrequest.sh index ac0e8df..a95b64d 100644 --- a/proxy_docker/app/script/watchrequest.sh +++ b/proxy_docker/app/script/watchrequest.sh @@ -133,7 +133,7 @@ watchpub32() { addresses=$(derivepubpath "{\"pub32\":\"${pub32}\",\"path\":\"${subspath}\"}") returncode=$? trace_rc ${returncode} - trace "[watchpub32] addresses=${addresses}" +# trace "[watchpub32] addresses=${addresses}" if [ "${returncode}" -eq 0 ]; then # result=$(create_wallet "${pub32}") @@ -233,7 +233,7 @@ insert_watches() { fi inserted_values="${inserted_values})" done - trace "[insert_watches] inserted_values=${inserted_values}" +# trace "[insert_watches] inserted_values=${inserted_values}" sql "INSERT OR IGNORE INTO watching (address, watching, callback0conf, callback1conf, imported, watching_by_pub32_id, pub32_index) VALUES ${inserted_values}" returncode=$?