improved hashrate accuracy
This commit is contained in:
parent
5963eb5a80
commit
4c76139909
@ -272,6 +272,32 @@ History.prototype.getGasSpending = function()
|
|||||||
return gasSpending;
|
return gasSpending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
History.prototype.getAvgHashrate = function()
|
||||||
|
{
|
||||||
|
if(this._items.length === 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
var difficultyHistory = _(this._items)
|
||||||
|
.map(function(item)
|
||||||
|
{
|
||||||
|
return item.block.difficulty;
|
||||||
|
})
|
||||||
|
.value();
|
||||||
|
|
||||||
|
var avgDifficulty = _.sum(difficultyHistory)/difficultyHistory.length;
|
||||||
|
|
||||||
|
var blocktimeHistory = _(this._items)
|
||||||
|
.map(function(item)
|
||||||
|
{
|
||||||
|
return item.block.time;
|
||||||
|
})
|
||||||
|
.value();
|
||||||
|
|
||||||
|
var avgBlocktime = _.sum(blocktimeHistory)/blocktimeHistory.length;
|
||||||
|
|
||||||
|
return avgDifficulty/1000 * 12 * (12/avgBlocktime);
|
||||||
|
}
|
||||||
|
|
||||||
History.prototype.getCharts = function()
|
History.prototype.getCharts = function()
|
||||||
{
|
{
|
||||||
var chartHistory = _(this._items)
|
var chartHistory = _(this._items)
|
||||||
@ -301,7 +327,8 @@ History.prototype.getCharts = function()
|
|||||||
transactions: _.pluck(chartHistory, 'transactions'),
|
transactions: _.pluck(chartHistory, 'transactions'),
|
||||||
gasSpending: _.pluck(chartHistory, 'gasSpending'),
|
gasSpending: _.pluck(chartHistory, 'gasSpending'),
|
||||||
propagation: this.getBlockPropagation(),
|
propagation: this.getBlockPropagation(),
|
||||||
uncleCount: this.getUncleCount()
|
uncleCount: this.getUncleCount(),
|
||||||
|
avgHashrate: this.getAvgHashrate()
|
||||||
}
|
}
|
||||||
|
|
||||||
return chart;
|
return chart;
|
||||||
|
@ -155,7 +155,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
case "charts":
|
case "charts":
|
||||||
$scope.lastBlocksTime = data.blocktime;
|
$scope.lastBlocksTime = data.blocktime;
|
||||||
$scope.avgBlockTime = data.avgBlocktime;
|
$scope.avgBlockTime = data.avgBlocktime;
|
||||||
$scope.avgHashrate = $scope.lastDifficulty / 1000000 * data.avgBlocktime;
|
$scope.avgHashrate = data.avgHashrate;
|
||||||
$scope.difficultyChart = data.difficulty;
|
$scope.difficultyChart = data.difficulty;
|
||||||
$scope.transactionDensity = data.transactions;
|
$scope.transactionDensity = data.transactions;
|
||||||
$scope.gasSpending = data.gasSpending;
|
$scope.gasSpending = data.gasSpending;
|
||||||
|
@ -27,14 +27,6 @@ block content
|
|||||||
span.small-title best block
|
span.small-title best block
|
||||||
span.big-details {{'#'}}{{ bestBlock | number}}
|
span.big-details {{'#'}}{{ bestBlock | number}}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
div.col-xs-2.stat-holder
|
|
||||||
div.big-info.difficulty.text-orange
|
|
||||||
div.pull-left.icon-full-width
|
|
||||||
i.icon-hashrate
|
|
||||||
div.pull-left
|
|
||||||
span.small-title avg hashrate
|
|
||||||
span.big-details {{ avgHashrate | number : 1 }} MH/s
|
|
||||||
div.clearfix
|
|
||||||
div.col-xs-2.stat-holder
|
div.col-xs-2.stat-holder
|
||||||
div.big-info.uncleCount.text-info
|
div.big-info.uncleCount.text-info
|
||||||
div.pull-left.icon-full-width
|
div.pull-left.icon-full-width
|
||||||
@ -60,6 +52,14 @@ block content
|
|||||||
span.small-title avg block time
|
span.small-title avg block time
|
||||||
span.big-details {{ avgBlockTime | avgTimeFilter }}
|
span.big-details {{ avgBlockTime | avgTimeFilter }}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
|
div.col-xs-2.stat-holder
|
||||||
|
div.big-info.difficulty.text-orange
|
||||||
|
div.pull-left.icon-full-width
|
||||||
|
i.icon-hashrate
|
||||||
|
div.pull-left
|
||||||
|
span.small-title avg network hashrate
|
||||||
|
span.big-details {{ avgHashrate | number : 1 }} MH/s
|
||||||
|
div.clearfix
|
||||||
div.clearfix
|
div.clearfix
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user