changed avg hashrate to last 64 blocks

This commit is contained in:
cubedro 2015-05-05 14:19:33 +03:00
parent 950ffa555a
commit 2b410d8e5d
1 changed files with 3 additions and 10 deletions

View File

@ -318,16 +318,9 @@ History.prototype.getAvgHashrate = function()
if( _.isEmpty(this._items) )
return 0;
var difficultyHistory = _( this._items )
.map(function (item)
{
return item.block.difficulty;
})
.value();
var avgDifficulty = _.sum(difficultyHistory) / difficultyHistory.length;
var blocktimeHistory = _( this._items )
.sortByOrder( 'height', false )
.slice(0, 64)
.map(function (item)
{
return item.block.time;
@ -336,7 +329,7 @@ History.prototype.getAvgHashrate = function()
var avgBlocktime = (_.sum(blocktimeHistory) / blocktimeHistory.length)/1000;
return this.bestBlock().block.difficulty / 12 * ( 12 / avgBlocktime );
return this.bestBlock().block.difficulty / avgBlocktime;
}
History.prototype.getMinersCount = function()