diff --git a/js/coin.js b/js/coin.js index a53fb0c..d8f5388 100644 --- a/js/coin.js +++ b/js/coin.js @@ -1092,32 +1092,37 @@ var unspent = xmlDoc.getElementsByTagName("unspent")[0]; - for(i=1;i<=unspent.childElementCount;i++){ - var u = xmlDoc.getElementsByTagName("unspent_"+i)[0] - var txhash = (u.getElementsByTagName("tx_hash")[0].childNodes[0].nodeValue).match(/.{1,2}/g).reverse().join("")+''; - var n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue; - var scr = script || u.getElementsByTagName("script")[0].childNodes[0].nodeValue; + if(unspent){ + for(i=1;i<=unspent.childElementCount;i++){ + var u = xmlDoc.getElementsByTagName("unspent_"+i)[0] + var txhash = (u.getElementsByTagName("tx_hash")[0].childNodes[0].nodeValue).match(/.{1,2}/g).reverse().join("")+''; + var n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue; + var scr = script || u.getElementsByTagName("script")[0].childNodes[0].nodeValue; - if(segwit){ - /* this is a small hack to include the value with the redeemscript to make the signing procedure smoother. - It is not standard and removed during the signing procedure. */ + if(segwit){ + /* this is a small hack to include the value with the redeemscript to make the signing procedure smoother. + It is not standard and removed during the signing procedure. */ - s = coinjs.script(); - s.writeBytes(Crypto.util.hexToBytes(script)); - s.writeOp(0); - s.writeBytes(coinjs.numToBytes(u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1, 8)); - scr = Crypto.util.bytesToHex(s.buffer); + s = coinjs.script(); + s.writeBytes(Crypto.util.hexToBytes(script)); + s.writeOp(0); + s.writeBytes(coinjs.numToBytes(u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1, 8)); + scr = Crypto.util.bytesToHex(s.buffer); + } + + var seq = sequence || false; + self.addinput(txhash, n, scr, seq); + value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1; + total++; } - - var seq = sequence || false; - self.addinput(txhash, n, scr, seq); - value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1; - total++; } - x.unspent = $(xmlDoc).find("unspent"); + x.result = xmlDoc.getElementsByTagName("result")[0].childNodes[0].nodeValue; + x.unspent = unspent; x.value = value; x.total = total; + x.response = xmlDoc.getElementsByTagName("response")[0].childNodes[0].nodeValue; + return callback(x); }); } diff --git a/sha1sum b/sha1sum index dd3b85e..021f4cf 100644 --- a/sha1sum +++ b/sha1sum @@ -1,9 +1,9 @@ ----- Version 1.6 2020.07.31 ---- +---- Version 1.6 2020.10.02 ---- 77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js 3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js 253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js cb5717166bf1c99abbd75a06013067c4a5897d5a ./js/coinbin.js -228cdcf29d33a5eadd360e85a6220e4853ee4590 ./js/coin.js +911fb7bdba24269029f27659e4040cd991b2307c ./js/coin.js 988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js