fix tx broadcast

This commit is contained in:
Matias Alejo Garcia 2014-02-18 14:51:45 -03:00
parent f5d8891317
commit 1e4a6179de
2 changed files with 9 additions and 9 deletions

View File

@ -17,24 +17,25 @@ module.exports.init = function(app, io_ext) {
module.exports.broadcastTx = function(tx) {
if (ios) {
var t = {};
var t;
if (typeof tx === 'string') {
console.log('[socket.js.22]',tx); //TODO
t = {
txid: tx
};
} else {
t = tx;
}
else {
t = {
txid: tx.txid,
size: tx.size,
};
// Outputs
var valueOut = 0;
t.vout.forEach(function(o) {
tx.vout.forEach(function(o) {
valueOut += o.value * util.COIN;
});
t.valueOut = parseInt(valueOut) / util.COIN;
console.log('[socket.js.36]',t); //TODO
}
ios.sockets. in ('inv').emit('tx', t);
}

View File

@ -265,7 +265,6 @@ function spec() {
Sync.prototype.handleNewTx = function(data) {
if (this.opts.shouldBroadcast) {
console.log('[Sync.js.268:shouldBroadcast:]', data.tx); //TODO
sockets.broadcastTx(data.tx);
}
};