mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-31 10:14:35 +01:00
We can now use notify_web response, sync block for newblock
This commit is contained in:
@@ -601,6 +601,7 @@ batch_webhooks() {
|
||||
local body
|
||||
local successful_recipient_ids
|
||||
local returncode
|
||||
local response
|
||||
|
||||
outputs=$(echo "${webhooks_data}" | jq -Mc ".[]")
|
||||
|
||||
@@ -626,7 +627,7 @@ batch_webhooks() {
|
||||
body='{"outputId":'${output_id}',"address":'${address}',"amount":'${amount}','${tx}'}'
|
||||
trace "[batch_webhooks] body=${body}"
|
||||
|
||||
notify_web "${webhook_url}" "${body}" ${TOR_ADDR_WATCH_WEBHOOKS}
|
||||
response=$(notify_web "${webhook_url}" "${body}" ${TOR_ADDR_WATCH_WEBHOOKS})
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
|
||||
@@ -253,8 +253,9 @@ curl_callback() {
|
||||
trace "Entering curl_callback()..."
|
||||
|
||||
local returncode
|
||||
local response
|
||||
|
||||
notify_web "${1}" "${2}" ${TOR_ADDR_WATCH_WEBHOOKS}
|
||||
response=$(notify_web "${1}" "${2}" ${TOR_ADDR_WATCH_WEBHOOKS})
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
|
||||
@@ -147,8 +147,9 @@ curl_callback_txid() {
|
||||
trace "Entering curl_callback_txid()..."
|
||||
|
||||
local returncode
|
||||
local response
|
||||
|
||||
notify_web "${1}" "${2}" ${TOR_TXID_WATCH_WEBHOOKS}
|
||||
response=$(notify_web "${1}" "${2}" ${TOR_TXID_WATCH_WEBHOOKS})
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
. ./batching.sh
|
||||
|
||||
newblock() {
|
||||
(
|
||||
flock -x 202
|
||||
|
||||
trace "Entering newblock()..."
|
||||
|
||||
local request=${1}
|
||||
@@ -24,4 +27,6 @@ newblock() {
|
||||
|
||||
do_callbacks_txid
|
||||
batch_check_webhooks
|
||||
|
||||
) 202>./.newblock.lock
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ notify_web() {
|
||||
http_code=$(echo "${response}" | jq -r ".http_code")
|
||||
trace "[notify_web] http_code=${http_code}"
|
||||
|
||||
echo "${response}"
|
||||
|
||||
if [ "${curl_code}" -eq "0" ] && [ "${returncode}" -eq "0" ]; then
|
||||
if [ "${http_code}" -lt "400" ]; then
|
||||
return 0
|
||||
|
||||
@@ -150,6 +150,7 @@ serve_ots_backoffice() {
|
||||
|
||||
local result
|
||||
local returncode
|
||||
local response
|
||||
|
||||
# Let's fetch all the incomplete stamping request
|
||||
local callbacks=$(sql 'SELECT hash, callbackUrl, requested, upgraded, id FROM stamp WHERE NOT calledback')
|
||||
@@ -213,7 +214,7 @@ serve_ots_backoffice() {
|
||||
if [ -n ${url} ]; then
|
||||
trace "[serve_ots_backoffice] url is not empty, now trying to call it!"
|
||||
|
||||
notify_web "${url}" ${TOR_OTS_WEBHOOKS}
|
||||
response=$(notify_web "${url}" ${TOR_OTS_WEBHOOKS})
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user