removed blocktime property
This commit is contained in:
parent
2b435cec23
commit
00a531fb18
10
lib/node.js
10
lib/node.js
@ -198,7 +198,6 @@ Node.prototype.getLatestBlocks = function()
|
|||||||
|
|
||||||
this.addBlockHistory(this.stats.block);
|
this.addBlockHistory(this.stats.block);
|
||||||
|
|
||||||
this.calculateBlockTimes();
|
|
||||||
this.stats.blocktimeAvg = this.blockTimesAvg();
|
this.stats.blocktimeAvg = this.blockTimesAvg();
|
||||||
this.stats.difficulty = this.difficultyChart();
|
this.stats.difficulty = this.difficultyChart();
|
||||||
this.stats.txDensity = this.txDensityChart();
|
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;
|
var diff = (key > 0 ? list[key - 1].timestamp : Math.floor(Date.now()/1000)) - block.timestamp;
|
||||||
|
|
||||||
self.blocks[key].blocktime = diff;
|
|
||||||
|
|
||||||
return diff;
|
return diff;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
blockTimes.shift();
|
||||||
|
|
||||||
return blockTimes;
|
return blockTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.blockTimesAvg = function()
|
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()
|
Node.prototype.difficultyChart = function()
|
||||||
|
Loading…
Reference in New Issue
Block a user