open wallet bug fix

This commit is contained in:
OutCast3k 2014-12-08 15:31:53 +00:00
parent 7fb188190b
commit af7cc4bf3d

View file

@ -414,13 +414,17 @@
for(i=1;i<=unspent.childElementCount;i++){ for(i=1;i<=unspent.childElementCount;i++){
var u = xmlDoc.getElementsByTagName("unspent_"+i)[0] var u = xmlDoc.getElementsByTagName("unspent_"+i)[0]
var txhash = u.getElementsByTagName("tx_hash")[0].childNodes[0].nodeValue; 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 n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue;
var script = u.getElementsByTagName("script")[0].childNodes[0].nodeValue;
self.addinput(txhash, n, script);
value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1; value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1;
total++; total++;
} }
x.unspent = $(data).find("unspent"); x.unspent = $(xmlDoc).find("unspent");
x.value = value; x.value = value;
x.total = total; x.total = total;
return callback(x); return callback(x);
@ -439,7 +443,7 @@
/* broadcast a transaction */ /* broadcast a transaction */
r.broadcast = function(callback, txhex){ r.broadcast = function(callback, txhex){
var tx = txhex || this.serialize() var tx = txhex || this.serialize();
coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=sendrawtransaction&rawtx='+tx+'&r='+Math.random(), callback, "GET"); coinjs.ajax(coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=sendrawtransaction&rawtx='+tx+'&r='+Math.random(), callback, "GET");
} }