From c2ca8e4a80823541025127ffed428b46715d250a Mon Sep 17 00:00:00 2001 From: Kaos Dynamics Date: Wed, 16 Jul 2014 21:36:27 +0100 Subject: [PATCH] Wrong hashrate calculation Hashes are not bytes: > 1 byte = 8 bits > 1 kilobyte = 1024 bytes Hashes are the units, and so therefore - as `k`, `m` only mean *10^3 and *10^6 > 1 hash = 1 hash > 1 kh = 1000 hashes --- libs/stats.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/stats.js b/libs/stats.js index e128190..557f8e0 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -274,9 +274,9 @@ module.exports = function(logger, portalConfig, poolConfigs){ var i = -1; var byteUnits = [ ' KH', ' MH', ' GH', ' TH', ' PH' ]; do { - hashrate = hashrate / 1024; + hashrate = hashrate / 1000; i++; - } while (hashrate > 1024); + } while (hashrate > 1000); return hashrate.toFixed(2) + byteUnits[i]; };