From 1e4a6179defb79fc918367b31283a341e69ecc74 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 18 Feb 2014 14:51:45 -0300 Subject: [PATCH] fix tx broadcast --- app/controllers/socket.js | 17 +++++++++-------- lib/Sync.js | 1 - 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/socket.js b/app/controllers/socket.js index cdf41cf..9a11f5b 100644 --- a/app/controllers/socket.js +++ b/app/controllers/socket.js @@ -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); } diff --git a/lib/Sync.js b/lib/Sync.js index 0695485..a712304 100644 --- a/lib/Sync.js +++ b/lib/Sync.js @@ -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); } };