Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mosquitto_pub insufficientfunds for spend/batchSpend #336

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions proxy_docker/app/script/batching.sh
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ batchspend() {
fi

if [ "${errorcode}" -eq "-6" ]; then
trace "[batchspend] mosquitto_pub -h broker -t insufficientfunds -m \"{\"method\":\"batchspend\",\"error\":\"${errorstring}\"}\""
mosquitto_pub -h broker -t insufficientfunds -m "{\"method\":\"batchspend\",\"error\":\"${errorstring}\"}"

# There's insufficient funds, we'll retry later, let's clear the tx_id for the outputs
sql "UPDATE recipient SET tx_id=null WHERE id IN (${whereclause})"
returncode=$?
Expand Down
6 changes: 6 additions & 0 deletions proxy_docker/app/script/walletoperations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ spend() {
data="{\"status\":\"accepted\""
data="${data},\"txid\":\"${txid}\",\"hash\":\"${tx_hash}\",\"details\":{\"address\":\"${address}\",\"amount\":${amount},\"firstseen\":${tx_ts_firstseen},\"size\":${tx_size},\"vsize\":${tx_vsize},\"replaceable\":${tx_replaceable},\"fee\":${fees},\"subtractfeefromamount\":${subtractfeefromamount}}}"
else
local errorstring=$(echo "${response}" | jq -e ".error")
local message=$(echo "${response}" | jq -e ".error.message")
if [ -n "${message}" ]; then
if [ "${message}" = "\"Insufficient funds\"" ]; then
trace "[spend] mosquitto_pub -h broker -t insufficientfunds -m \"{\"method\":\"spend\",\"error\":\"${errorstring}\"}\""
mosquitto_pub -h broker -t insufficientfunds -m "{\"method\":\"spend\",\"error\":\"${errorstring}\"}"
fi

data="{\"message\":${message}}"
else
data="{\"message\":null}"
Expand Down