From 00a531fb18e44945c7879950c4daf4826470550d Mon Sep 17 00:00:00 2001 From: cubedro Date: Mon, 23 Feb 2015 16:18:43 +0200 Subject: [PATCH] removed blocktime property --- lib/node.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node.js b/lib/node.js index 612acb4..c7474bb 100644 --- a/lib/node.js +++ b/lib/node.js @@ -198,7 +198,6 @@ Node.prototype.getLatestBlocks = function() this.addBlockHistory(this.stats.block); - this.calculateBlockTimes(); this.stats.blocktimeAvg = this.blockTimesAvg(); this.stats.difficulty = this.difficultyChart(); this.stats.txDensity = this.txDensityChart(); @@ -225,19 +224,20 @@ Node.prototype.calculateBlockTimes = function() { var diff = (key > 0 ? list[key - 1].timestamp : Math.floor(Date.now()/1000)) - block.timestamp; - self.blocks[key].blocktime = diff; - return diff; }); + blockTimes.shift(); + return blockTimes; } Node.prototype.blockTimesAvg = function() { - var sum = _.reduce(this.blocks, function(memo, block) { return memo + block.blocktime;}, 0); + var blockTimes = this.calculateBlockTimes(); + var sum = _.reduce(blockTimes, function(memo, time) { return memo + time;}, 0); - return sum/this.blocks.length; + return sum/blockTimes.length; } Node.prototype.difficultyChart = function()