From 0fb543c3ed066a90c79ada0d10dfad96515718de Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sun, 19 Jan 2014 17:17:24 +0100 Subject: [PATCH] [FIX] Honor target_bits for hashrate --- public/include/classes/statistics.class.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index 1dac7361..efefa949 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -458,21 +458,21 @@ class Statistics extends Base { SELECT a.id AS id, a.username AS account, - IFNULL(ROUND(SUM(t1.difficulty) * POW(2, 16) / ? / 1000, 2), 0) AS hashrate, + IFNULL(ROUND(SUM(t1.difficulty) * POW(2, " . $this->config['target_bits'] . ") / ? / 1000, 2), 0) AS hashrate, ROUND(COUNT(t1.id) / ?, 2) AS sharerate, IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff FROM ( SELECT - id, - IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty, - username + id, + IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty, + username FROM shares WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y' UNION SELECT - share_id, - IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty, - username + share_id, + IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty, + username FROM shares_archive WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y' ) AS t1 @@ -490,7 +490,6 @@ class Statistics extends Base { var_dump($aData); return $this->memcache->setCache(STATISTICS_ALL_USER_HASHRATES, $aData); } else { - echo $this->mysqli->error; return $this->sqlError(); } }