From a4a0eef2b0cdd00a72c2702c0db543db47b6a074 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Wed, 12 Feb 2014 11:59:29 -0300 Subject: [PATCH] fixed rounding btc values on homepages --- app/controllers/socket.js | 5 +++-- public/views/index.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/socket.js b/app/controllers/socket.js index 603c7ee..e0017a7 100644 --- a/app/controllers/socket.js +++ b/app/controllers/socket.js @@ -3,6 +3,7 @@ // server-side socket behaviour // io is a variable already taken in express var ios = null; +var util = require('bitcore/util/util'); module.exports.init = function(app, io_ext) { ios = io_ext; @@ -25,10 +26,10 @@ module.exports.broadcastTx = function(tx) { // Outputs var valueOut = 0; t.vout.forEach( function(o) { - valueOut += o.value * 100000000; + valueOut += o.value * util.COIN; }); - t.valueOut = valueOut / 100000000; + t.valueOut = parseInt(valueOut) / util.COIN; } ios.sockets.in('inv').emit('tx', t); } diff --git a/public/views/index.html b/public/views/index.html index ec097d4..c2412a6 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -24,7 +24,7 @@ {{humanSince(b.time)}} {{b.txlength}} - {{b.size}} + {{b.size}} bytes