Skip to content

Commit

Permalink
Small fixes in removefrombatch and watchtxid
Browse files Browse the repository at this point in the history
  • Loading branch information
Kexkey committed May 26, 2021
1 parent 5275b6c commit 17a953c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion proxy_docker/app/script/batching.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ removefrombatch() {
trace "[removefrombatch] id missing"
response='{"result":null,"error":{"code":-32700,"message":"outputId is required","data":'${request}'}}'
else
batcher_id=$(sql "SELECT batcher_id FROM recipient WHERE id=${id}")
# We don't want to remove an already spent output
batcher_id=$(sql "SELECT batcher_id FROM recipient WHERE id=${id} AND tx_id IS NULL")
returncode=$?
trace_rc ${returncode}

Expand Down
14 changes: 13 additions & 1 deletion proxy_docker/app/script/watchrequest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ watchtxidrequest() {
trace "[watchtxidrequest] cbxconf_url=${cbxconf_url}"
local nbxconf=$(echo "${request}" | jq ".nbxconf")
trace "[watchtxidrequest] nbxconf=${nbxconf}"
local cb1cond
local cbxcond
local inserted
local id_inserted
local result
Expand All @@ -353,7 +355,17 @@ watchtxidrequest() {

if [ "${returncode}" -eq 0 ]; then
inserted=1
id_inserted=$(sql "SELECT id FROM watching_by_txid WHERE txid=${txid} AND callback1conf=${cb1conf_url} AND callbackxconf=${cbxconf_url}")
if [ "${cb1conf_url}" = "null" ]; then
cb1cond=" IS NULL"
else
cb1cond="=${cb1conf_url}"
fi
if [ "${cbxconf_url}" = "null" ]; then
cbxcond=" IS NULL"
else
cbxcond="=${cbxconf_url}"
fi
id_inserted=$(sql "SELECT id FROM watching_by_txid WHERE txid=${txid} AND callback1conf${cb1cond} AND callbackxconf${cbxcond}")
trace "[watchtxidrequest] id_inserted: ${id_inserted}"
else
inserted=0
Expand Down

0 comments on commit 17a953c

Please sign in to comment.