Merge pull request #252 from cmgustavo/bug/Rounding-issue

Rounding issue: transactions on front page sometimes have too many decimal places
This commit is contained in:
Manuel Aráoz 2014-02-12 14:01:07 -02:00
commit d3a167b170
2 changed files with 4 additions and 3 deletions

View File

@ -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);
}

View File

@ -24,7 +24,7 @@
</td>
<td><span class="ellipsis">{{humanSince(b.time)}}</span></td>
<td class="text-right">{{b.txlength}}</td>
<td class="text-right">{{b.size}}</td>
<td class="text-right">{{b.size}} bytes</td>
</tr>
</tbody>
</table>