mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-04 13:35:28 +01:00
tx_confirmation and newblock events published
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user