fixup! Bugfix: Hashrate incorrect

This commit is contained in:
joshuayabut 2016-12-26 00:35:40 +00:00
parent c640b4fbaf
commit c83ed07049
2 changed files with 12 additions and 14 deletions

View File

@ -271,14 +271,12 @@ module.exports = function(logger, portalConfig, poolConfigs){
};
this.getReadableHashRateString = function(hashrate){
var i = -1;
var byteUnits = [ ' Sol',' KSol', ' MSol', ' GSol', ' TSol', ' PSol' ];
do {
hashrate = (hashrate * 2) / 1000000;
i++;
} while (hashrate > 1000);
if (hashrate === 0)
return '0 Sol';
var byteUnits = [ ' Sol', ' KSol', ' MSol', ' GSol', ' TSol', ' PSol' ];
hashrate = (hashrate * 2);
var i = Math.floor((Math.log(hashrate/1000) / Math.log(1000)) - 1);
hashrate = (hashrate/1000) / Math.pow(1000, i + 1);
return hashrate.toFixed(2) + byteUnits[i];
};
};

View File

@ -69,12 +69,12 @@ function buildChartData(){
}
function getReadableHashRateString(hashrate){
var i = -1;
var byteUnits = [ ' Sol',' KSol', ' MSol', ' GSol', ' TSol', ' PSol' ];
do {
hashrate = (hashrate * 2) / 1000000;
i++;
} while (hashrate > 1000);
if (hashrate === 0)
return '0 Sol';
var byteUnits = [ ' Sol', ' KSol', ' MSol', ' GSol', ' TSol', ' PSol' ];
hashrate = (hashrate * 2);
var i = Math.floor((Math.log(hashrate/1000) / Math.log(1000)) - 1);
hashrate = (hashrate/1000) / Math.pow(1000, i + 1);
return Math.round(hashrate) + byteUnits[i];
}