|
|
|
@ -429,13 +429,32 @@ History.prototype.getBlockTimes = function() |
|
|
|
|
.reverse() |
|
|
|
|
.map(function (item) |
|
|
|
|
{ |
|
|
|
|
return item.block.time; |
|
|
|
|
return item.block.time / 1000; |
|
|
|
|
}) |
|
|
|
|
.value(); |
|
|
|
|
|
|
|
|
|
return blockTimes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
History.prototype.getAvgBlocktime = function() |
|
|
|
|
{ |
|
|
|
|
var blockTimes = _( this._items ) |
|
|
|
|
.sortByOrder( 'height', false ) |
|
|
|
|
// .filter(function (item)
|
|
|
|
|
// {
|
|
|
|
|
// return item.block.trusted;
|
|
|
|
|
// })
|
|
|
|
|
// .slice(0, MAX_BINS)
|
|
|
|
|
.reverse() |
|
|
|
|
.map(function (item) |
|
|
|
|
{ |
|
|
|
|
return item.block.time / 1000; |
|
|
|
|
}) |
|
|
|
|
.value(); |
|
|
|
|
|
|
|
|
|
return _.sum(blockTimes) / (blockTimes.length === 0 ? 1 : blockTimes.length); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
History.prototype.getGasLimit = function() |
|
|
|
|
{ |
|
|
|
|
var gasLimitHistory = _( this._items ) |
|
|
|
@ -598,7 +617,8 @@ History.prototype.getCharts = function() |
|
|
|
|
this._callback(null, { |
|
|
|
|
height : _.pluck( chartHistory, 'height' ), |
|
|
|
|
blocktime : _.pluck( chartHistory, 'blocktime' ), |
|
|
|
|
avgBlocktime : _.sum(_.pluck( chartHistory, 'blocktime' )) / (chartHistory.length === 0 ? 1 : chartHistory.length), |
|
|
|
|
// avgBlocktime : _.sum(_.pluck( chartHistory, 'blocktime' )) / (chartHistory.length === 0 ? 1 : chartHistory.length),
|
|
|
|
|
avgBlocktime : this.getAvgBlocktime(), |
|
|
|
|
difficulty : _.pluck( chartHistory, 'difficulty' ), |
|
|
|
|
uncles : _.pluck( chartHistory, 'uncles' ), |
|
|
|
|
transactions : _.pluck( chartHistory, 'transactions' ), |
|
|
|
|