From 8e3ac5ab2c3cfbc9a4dc055e888a1076dc874a77 Mon Sep 17 00:00:00 2001 From: kexkey Date: Thu, 28 Nov 2019 20:56:30 -0500 Subject: [PATCH] Added some data to confirmation event --- proxy_docker/app/script/confirmation.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy_docker/app/script/confirmation.sh b/proxy_docker/app/script/confirmation.sh index b079659..396b63d 100644 --- a/proxy_docker/app/script/confirmation.sh +++ b/proxy_docker/app/script/confirmation.sh @@ -149,6 +149,7 @@ confirmation() { address=$(echo "${row}" | cut -d '|' -f2) ######################################################################################################## # Let's now insert in the join table if not already done + tx_vout_amount=$(echo "${tx_details}" | jq ".result.details | map(select(.address==\"${address}\"))[0] | .amount | fabs" | awk '{ printf "%.8f", $0 }') if [ -z "${tx}" ]; then trace "[confirmation] For this tx, there's no watching_tx row, let's create it" local watching_id @@ -159,7 +160,6 @@ confirmation() { # In the case of us spending to a watched address, the address appears twice in the details, # once on the spend side (negative amount) and once on the receiving side (positive amount) tx_vout_n=$(echo "${tx_details}" | jq ".result.details | map(select(.address==\"${address}\"))[0] | .vout") - tx_vout_amount=$(echo "${tx_details}" | jq ".result.details | map(select(.address==\"${address}\"))[0] | .amount | fabs" | awk '{ printf "%.8f", $0 }') sql "INSERT OR IGNORE INTO watching_tx (watching_id, tx_id, vout, amount) VALUES (${watching_id}, ${id_inserted}, ${tx_vout_n}, ${tx_vout_amount})" trace_rc $? else @@ -185,8 +185,8 @@ confirmation() { # There's an event message, let's publish it! # We use the pid as the response-topic, so there's no conflict in responses. - trace "[confirmation] mosquitto_pub -h broker -t conf_event -m \"{\"address\":\"${address}\",\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}\"" - response=$(mosquitto_pub -h broker -t conf_event -m "{\"address\":\"${address}\",\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}") + trace "[confirmation] mosquitto_pub -h broker -t conf_event -m \"{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}\"" + response=$(mosquitto_pub -h broker -t conf_event -m "{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}") returncode=$? trace_rc ${returncode} fi