mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-17 12:45:22 +01:00
unwatch the xpubs!
This commit is contained in:
@@ -96,6 +96,20 @@ main()
|
|||||||
response_to_client "${response}" ${?}
|
response_to_client "${response}" ${?}
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
unwatchxpubbyxpub)
|
||||||
|
# GET http://192.168.111.152:8080/unwatchxpubbyxpub/tpubD6NzVbkrYhZ4YR3QK2tyfMMvBghAvqtNaNK1LTyDWcRHLcMUm3ZN2cGm5BS3MhCRCeCkXQkTXXjiJgqxpqXK7PeUSp86DTTgkLpcjMtpKWk
|
||||||
|
|
||||||
|
response=$(unwatchpub32request "${line}")
|
||||||
|
response_to_client "${response}" ${?}
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
unwatchxpubbylabel)
|
||||||
|
# GET http://192.168.111.152:8080/unwatchxpubbylabel/4421
|
||||||
|
|
||||||
|
response=$(unwatchpub32labelrequest "${line}")
|
||||||
|
response_to_client "${response}" ${?}
|
||||||
|
break
|
||||||
|
;;
|
||||||
getactivewatchesbyxpub)
|
getactivewatchesbyxpub)
|
||||||
# GET http://192.168.111.152:8080/getactivewatchesbyxpub/tpubD6NzVbkrYhZ4YR3QK2tyfMMvBghAvqtNaNK1LTyDWcRHLcMUm3ZN2cGm5BS3MhCRCeCkXQkTXXjiJgqxpqXK7PeUSp86DTTgkLpcjMtpKWk
|
# GET http://192.168.111.152:8080/getactivewatchesbyxpub/tpubD6NzVbkrYhZ4YR3QK2tyfMMvBghAvqtNaNK1LTyDWcRHLcMUm3ZN2cGm5BS3MhCRCeCkXQkTXXjiJgqxpqXK7PeUSp86DTTgkLpcjMtpKWk
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
. ./trace.sh
|
. ./trace.sh
|
||||||
. ./sql.sh
|
. ./sql.sh
|
||||||
|
|
||||||
unwatchrequest()
|
unwatchrequest() {
|
||||||
{
|
|
||||||
trace "Entering unwatchrequest()..."
|
trace "Entering unwatchrequest()..."
|
||||||
|
|
||||||
local request=${1}
|
local request=${1}
|
||||||
local address=$(echo "${request}" | cut -d ' ' -f2 | cut -d '/' -f3)
|
local address=$(echo "${request}" | cut -d ' ' -f2 | cut -d '/' -f3)
|
||||||
local returncode
|
local returncode
|
||||||
trace "[unwatchrequest] Unwatch request on address ${address})"
|
trace "[unwatchrequest] Unwatch request on address ${address}"
|
||||||
|
|
||||||
sql "UPDATE watching SET watching=0 WHERE address=\"${address}\""
|
sql "UPDATE watching SET watching=0 WHERE address=\"${address}\""
|
||||||
returncode=$?
|
returncode=$?
|
||||||
@@ -24,4 +23,60 @@ unwatchrequest()
|
|||||||
return ${returncode}
|
return ${returncode}
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${0}" in *unwatchrequest.sh) unwatchrequest $@;; esac
|
unwatchpub32request() {
|
||||||
|
trace "Entering unwatchpub32request()..."
|
||||||
|
|
||||||
|
local request=${1}
|
||||||
|
local pub32=$(echo "${request}" | cut -d ' ' -f2 | cut -d '/' -f3)
|
||||||
|
local id
|
||||||
|
local returncode
|
||||||
|
trace "[unwatchpub32request] Unwatch pub32 ${pub32}"
|
||||||
|
|
||||||
|
id=$(sql "SELECT id FROM watching WHERE pub32='${pub32}'")
|
||||||
|
trace "[unwatchpub32request] id: ${id}"
|
||||||
|
|
||||||
|
sql "UPDATE watching_by_pub32 SET watching=0 WHERE id=${id}"
|
||||||
|
returncode=$?
|
||||||
|
trace_rc ${returncode}
|
||||||
|
|
||||||
|
sql "UPDATE watching SET watching=0 WHERE watching_by_pub32_id=\"${id}\""
|
||||||
|
returncode=$?
|
||||||
|
trace_rc ${returncode}
|
||||||
|
|
||||||
|
data="{\"event\":\"unwatchxpubbyxpub\",\"pub32\":\"${pub32}\"}"
|
||||||
|
trace "[unwatchpub32request] responding=${data}"
|
||||||
|
|
||||||
|
echo "${data}"
|
||||||
|
|
||||||
|
return ${returncode}
|
||||||
|
}
|
||||||
|
|
||||||
|
unwatchpub32labelrequest() {
|
||||||
|
trace "Entering unwatchpub32labelrequest()..."
|
||||||
|
|
||||||
|
local request=${1}
|
||||||
|
local label=$(echo "${request}" | cut -d ' ' -f2 | cut -d '/' -f3)
|
||||||
|
local id
|
||||||
|
local returncode
|
||||||
|
trace "[unwatchpub32labelrequest] Unwatch xpub label ${label}"
|
||||||
|
|
||||||
|
id=$(sql "SELECT id FROM watching WHERE label='${label}'")
|
||||||
|
returncode=$?
|
||||||
|
trace_rc ${returncode}
|
||||||
|
trace "[unwatchpub32labelrequest] id: ${id}"
|
||||||
|
|
||||||
|
sql "UPDATE watching_by_pub32 SET watching=0 WHERE id=${id}"
|
||||||
|
returncode=$?
|
||||||
|
trace_rc ${returncode}
|
||||||
|
|
||||||
|
sql "UPDATE watching SET watching=0 WHERE watching_by_pub32_id=\"${id}\""
|
||||||
|
returncode=$?
|
||||||
|
trace_rc ${returncode}
|
||||||
|
|
||||||
|
data="{\"event\":\"unwatchxpubbylabel\",\"pub32\":\"${pub32}\"}"
|
||||||
|
trace "[unwatchpub32labelrequest] responding=${data}"
|
||||||
|
|
||||||
|
echo "${data}"
|
||||||
|
|
||||||
|
return ${returncode}
|
||||||
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ extend_watchers() {
|
|||||||
|
|
||||||
local last_imported_n
|
local last_imported_n
|
||||||
local row
|
local row
|
||||||
row=$(sql "SELECT pub32, label, derivation_path, callback0conf, callback1conf, last_imported_n FROM watching_by_pub32 WHERE id=${watching_by_pub32_id}")
|
row=$(sql "SELECT pub32, label, derivation_path, callback0conf, callback1conf, last_imported_n FROM watching_by_pub32 WHERE id=${watching_by_pub32_id} AND watching")
|
||||||
returncode=$?
|
returncode=$?
|
||||||
trace_rc ${returncode}
|
trace_rc ${returncode}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user