mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-08 15:35:44 +01:00
Fixes + docs
This commit is contained in:
@@ -29,9 +29,8 @@ confirmation() {
|
||||
|
||||
local returncode
|
||||
local txid=${1}
|
||||
local txn_payload
|
||||
local tx_details
|
||||
txn_payload="$(get_transaction ${txid})"
|
||||
tx_details="$(get_transaction ${txid})"
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
trace "[confirmation] tx_details=${tx_details}"
|
||||
@@ -39,9 +38,6 @@ confirmation() {
|
||||
trace "[confirmation] Transaction not in watcher, exiting."
|
||||
return 0
|
||||
fi
|
||||
# We need make sure to discard error results generated by get_transction tryin to find a watching wallet's `txn in
|
||||
# spender wallet first,return code will tell if there's an actaul error. See #153
|
||||
tx_details="$(echo $txn_payload | jq '. | select(.result != null)')"
|
||||
########################################################################################################
|
||||
# First of all, let's make sure we're working on watched addresses...
|
||||
local address
|
||||
|
||||
@@ -238,10 +238,10 @@ main() {
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
gettxnslist)
|
||||
# curl (GET) http://192.168.111.152:8080/gettxnslist/20/10
|
||||
get_txns_spending)
|
||||
# curl (GET) http://192.168.111.152:8080/get_txns_spending/20/10
|
||||
|
||||
response=$(gettxnslist $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3) $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4))
|
||||
response=$(get_txns_spending $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3) $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f4))
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
|
||||
send_to_watcher_node() {
|
||||
trace "Entering send_to_watcher_node()..."
|
||||
send_to_bitcoin_node ${WATCHER_NODE_RPC_URL}/${WATCHER_BTC_NODE_DEFAULT_WALLET} ${WATCHER_NODE_RPC_CFG} $@
|
||||
local node_payload
|
||||
node_payload="$(send_to_bitcoin_node ${WATCHER_NODE_RPC_URL}/${WATCHER_BTC_NODE_DEFAULT_WALLET} ${WATCHER_NODE_RPC_CFG} $@)"
|
||||
local returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
if [ "${returncode}" -ne 0 ]; then
|
||||
# Ok, since we now have multiple watching wallets, we need to try them all if it fails
|
||||
# We have 2 right now: watching and watching-for-xpubs
|
||||
send_to_watcher_node_wallet ${WATCHER_BTC_NODE_XPUB_WALLET} $@
|
||||
node_payload="$(send_to_watcher_node_wallet ${WATCHER_BTC_NODE_XPUB_WALLET} $@)"
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
fi
|
||||
|
||||
echo "$node_payload"
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ bumpfee() {
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
gettxnslist() {
|
||||
trace "Entering gettxnslist()... with count: $1 , skip: $2"
|
||||
get_txns_spending() {
|
||||
trace "Entering get_txns_spending()... with count: $1 , skip: $2"
|
||||
local count="$1"
|
||||
local skip="$2"
|
||||
local response
|
||||
@@ -132,19 +132,19 @@ gettxnslist() {
|
||||
response=$(send_to_spender_node "${data}")
|
||||
local returncode=$?
|
||||
trace_rc ${returncode}
|
||||
trace "[gettxnlist] response=${response}"
|
||||
trace "[get_txns_spending] response=${response}"
|
||||
|
||||
if [ "${returncode}" -eq 0 ]; then
|
||||
local txns=$(echo ${response} | jq -rc ".result")
|
||||
trace "[gettxnlist] txns=${txns}"
|
||||
trace "[get_txns_spending] txns=${txns}"
|
||||
|
||||
data="{\"txns\":${txns}}"
|
||||
else
|
||||
trace "[gettxnlist] Coudn't get txns!"
|
||||
trace "[get_txns_spending] Coudn't get txns!"
|
||||
data=""
|
||||
fi
|
||||
|
||||
trace "[gettransactions] responding=${data}"
|
||||
trace "[get_txns_spending] responding=${data}"
|
||||
echo "${data}"
|
||||
|
||||
return ${returncode}
|
||||
|
||||
Reference in New Issue
Block a user