fix bug : use only confirmed utxos

This commit is contained in:
Sai Raj 2019-06-08 11:51:47 +05:30 committed by GitHub
parent c33921922b
commit bef19169d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -417,8 +417,10 @@ function splitUTXOs(sender,num,wif){
var splitAmt = sendAmt + fee;
var TotalAmt = splitAmt*(num+1);
for(var x = utxos.length-1; (x >= 0) && (utxoAmt < TotalAmt+splitfee); x--){
if(utxos[x].confirmations){
trx.addinput(utxos[x].txid, utxos[x].vout, utxos[x].scriptPubKey)
utxoAmt += utxos[x].amount;
}
}
if(utxoAmt < TotalAmt+splitfee){
alert("Insufficient balance!");
@ -465,8 +467,10 @@ function refreshUTXOs(){
var response = ajax("GET",`api/addr/${floID}/utxo`);
var utxos = JSON.parse(response);
for(var x = utxos.length-1; (x >= 0); x--){
if(utxos[x].confirmations){
trx.addinput(utxos[x].txid, utxos[x].vout, utxos[x].scriptPubKey)
utxoAmt += utxos[x].amount;
}
}
if(utxoAmt <= refreshfee){
alert("Insufficient Balance!");