Browse Source

Don't send balance to self when AC UTXO count is 0

This bug has been fixed in iguana
master
Luke Childs 6 years ago
parent
commit
ad553bae1c
  1. 21
      utxosplitter.sh

21
utxosplitter.sh

@ -17,16 +17,6 @@ calc() {
awk "BEGIN { print "$*" }"
}
waitforconfirm () {
confirmations=0
while [[ ${confirmations} -lt 1 ]]; do
sleep 1
confirmations=$(${cli} gettransaction $1 | jq -r .confirmations)
# Keep re-broadcasting
${cli} sendrawtransaction $(${cli} getrawtransaction $1) > /dev/null 2>&1
done
}
if [[ -z "${coin}" ]]; then
echo "----------------------------------------"
echo "Splitting UTXOs - ${date}"
@ -42,7 +32,6 @@ if [[ -z "${coin}" ]]; then
exit;
fi
is_assetchain=$(./listassetchains | grep -w ${coin})
cli=$(./listclis.sh ${coin})
if [[ "${coin}" = "KMD" ]]; then
@ -67,16 +56,6 @@ locked_utxos=$(${cli} listlockunspent | jq -r length)
utxo_count=$(calc ${unlocked_utxos}+${locked_utxos})
echo "[${coin}] Current UTXO count is ${utxo_count}"
if [[ ${utxo_count} = 0 ]] && [[ $is_assetchain ]]; then
echo "[${coin}] Sending entire balance back to main address"
txid=$(${cli} sendtoaddress RPxsaGNqTKzPnbm5q7QXwu7b6EZWuLxJG3 $(${cli} getbalance) "" "" true)
echo "[${coin}] Balance returned TXID: ${txid}"
echo "[${coin}] Waiting for confirmation of returned funds"
waitforconfirm ${txid}
echo "[${coin}] Returned funds confirmed"
fi
utxo_required=$(calc ${target_utxo_count}-${utxo_count})
if [[ ${utxo_count} -le ${split_threshold} ]]; then

Loading…
Cancel
Save