[FIX] Honor target_bits for hashrate
This commit is contained in:
parent
cf49db4535
commit
0fb543c3ed
@ -458,21 +458,21 @@ class Statistics extends Base {
|
|||||||
SELECT
|
SELECT
|
||||||
a.id AS id,
|
a.id AS id,
|
||||||
a.username AS account,
|
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,
|
ROUND(COUNT(t1.id) / ?, 2) AS sharerate,
|
||||||
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff
|
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty,
|
IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty,
|
||||||
username
|
username
|
||||||
FROM shares
|
FROM shares
|
||||||
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y'
|
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y'
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
share_id,
|
share_id,
|
||||||
IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty,
|
IFNULL(IF(difficulty=0, pow(2, (20 - 16)), difficulty), 0) AS difficulty,
|
||||||
username
|
username
|
||||||
FROM shares_archive
|
FROM shares_archive
|
||||||
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y'
|
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y'
|
||||||
) AS t1
|
) AS t1
|
||||||
@ -490,7 +490,6 @@ class Statistics extends Base {
|
|||||||
var_dump($aData);
|
var_dump($aData);
|
||||||
return $this->memcache->setCache(STATISTICS_ALL_USER_HASHRATES, $aData);
|
return $this->memcache->setCache(STATISTICS_ALL_USER_HASHRATES, $aData);
|
||||||
} else {
|
} else {
|
||||||
echo $this->mysqli->error;
|
|
||||||
return $this->sqlError();
|
return $this->sqlError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user