Made confTarget optional, so we just default bumpfee when not supplied

This commit is contained in:
kexkey
2019-08-27 14:31:35 -04:00
committed by kexkey
parent b3c4219672
commit 1a45edf008
4 changed files with 20 additions and 6 deletions

View File

@@ -259,6 +259,7 @@ main()
bumpfee)
# POST http://192.168.111.152:8080/bumpfee
# BODY {"txid":"af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648","confTarget":4}
# BODY {"txid":"af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648"}
response=$(bumpfee "${line}")
response_to_client "${response}" ${?}

View File

@@ -68,12 +68,24 @@ bumpfee() {
local request=${1}
local txid=$(echo "${request}" | jq ".txid" | tr -d '"')
trace "[bumpfee] txid=${txid}"
local confTarget=$(echo "${request}" | jq ".confTarget")
trace "[bumpfee] confTarget=${confTarget}"
local response
response=$(send_to_spender_node "{\"method\":\"bumpfee\",\"params\":[\"${txid}\",{\"confTarget\":${confTarget}}]}")
local returncode=$?
local confTarget
local response
local returncode
# jq -e will have a return code of 1 if the supplied tag is null.
confTarget=$(echo "${request}" | jq -e ".confTarget")
if [ "$?" -ne "0" ]; then
# confTarget tag null, so there's no confTarget
trace "[bumpfee] confTarget="
response=$(send_to_spender_node "{\"method\":\"bumpfee\",\"params\":[\"${txid}\"]}")
returncode=$?
else
trace "[bumpfee] confTarget=${confTarget}"
response=$(send_to_spender_node "{\"method\":\"bumpfee\",\"params\":[\"${txid}\",{\"confTarget\":${confTarget}}]}")
returncode=$?
fi
trace_rc ${returncode}
trace "[bumpfee] response=${response}"