diff --git a/proxy_docker/app/script/confirmation.sh b/proxy_docker/app/script/confirmation.sh index 396b63d..37b0599 100644 --- a/proxy_docker/app/script/confirmation.sh +++ b/proxy_docker/app/script/confirmation.sh @@ -184,9 +184,8 @@ confirmation() { if [ -n "${event_message}" ]; then # 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 \"{\"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}\"}") + trace "[confirmation] mosquitto_pub -h broker -t tx_confirmation -m \"{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}\"" + response=$(mosquitto_pub -h broker -t tx_confirmation -m "{\"txid\":\"${txid}\",\"address\":\"${address}\",\"amount\":${tx_vout_amount},\"confirmations\":${tx_nb_conf},\"event_message\":\"${event_message}\"}") returncode=$? trace_rc ${returncode} fi diff --git a/proxy_docker/app/script/newblock.sh b/proxy_docker/app/script/newblock.sh index c266eeb..1ae3d05 100644 --- a/proxy_docker/app/script/newblock.sh +++ b/proxy_docker/app/script/newblock.sh @@ -2,6 +2,7 @@ . ./trace.sh . ./callbacks_txid.sh +. ./blockchainrpc.sh newblock() { trace "Entering newblock()..." @@ -9,5 +10,16 @@ newblock() { local request=${1} local blockhash=$(echo "${request}" | cut -d ' ' -f2 | cut -d '/' -f3) + local blockinfo + blockinfo=$(get_block_info ${blockhash}) + + local blockheight + blockheight=$(echo ${blockinfo} | jq -r ".result.height") + + trace "[newblock] mosquitto_pub -h broker -t newblock -m \"{\"blockhash\":\"${blockhash}\",\"blockheight\":\"${blockheight}\"}\"" + response=$(mosquitto_pub -h broker -t newblock -m "{\"blockhash\":\"${blockhash}\",\"blockheight\":\"${blockheight}\"}") + returncode=$? + trace_rc ${returncode} + do_callbacks_txid }