@@ -45,37 +45,37 @@ function getLastBlocksbyTime() {
4545 IFNULL(SUM(IF(confirmations > 0, 1, 0)), 0) AS TotalValid,
4646 IFNULL(SUM(IF(confirmations = -1, 1, 0)), 0) AS TotalOrphan,
4747 IFNULL(SUM(IF(confirmations > 0, difficulty, 0)), 0) AS TotalDifficulty,
48- IFNULL(ROUND( SUM(IF(confirmations > -1, shares, 0) )), 0) AS TotalShares,
48+ IFNULL(SUM(IF(confirmations > -1, shares, 0)), 0) AS TotalShares,
4949 IFNULL(SUM(IF(confirmations > -1, amount, 0)), 0) AS TotalAmount,
5050 IFNULL(SUM(IF(FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), 1, 0)), 0) AS 1HourTotal,
5151 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), 1, 0)), 0) AS 1HourValid,
5252 IFNULL(SUM(IF(confirmations = -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), 1, 0)), 0) AS 1HourOrphan,
5353 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), difficulty, 0)), 0) AS 1HourDifficulty,
54- IFNULL(ROUND( SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), shares, 0) )), 0) AS 1HourShares,
54+ IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), shares, 0)), 0) AS 1HourShares,
5555 IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 3600 SECOND), amount, 0)), 0) AS 1HourAmount,
5656 IFNULL(SUM(IF(FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), 1, 0)), 0) AS 24HourTotal,
5757 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), 1, 0)), 0) AS 24HourValid,
5858 IFNULL(SUM(IF(confirmations = -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), 1, 0)), 0) AS 24HourOrphan,
5959 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), difficulty, 0)), 0) AS 24HourDifficulty,
60- IFNULL(ROUND( SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), shares, 0) )), 0) AS 24HourShares,
60+ IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), shares, 0)), 0) AS 24HourShares,
6161 IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 86400 SECOND), amount, 0)), 0) AS 24HourAmount,
6262 IFNULL(SUM(IF(FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), 1, 0)), 0) AS 7DaysTotal,
6363 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), 1, 0)), 0) AS 7DaysValid,
6464 IFNULL(SUM(IF(confirmations = -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), 1, 0)), 0) AS 7DaysOrphan,
6565 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), difficulty, 0)), 0) AS 7DaysDifficulty,
66- IFNULL(ROUND( SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), shares, 0) )), 0) AS 7DaysShares,
66+ IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), shares, 0)), 0) AS 7DaysShares,
6767 IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 604800 SECOND), amount, 0)), 0) AS 7DaysAmount,
6868 IFNULL(SUM(IF(FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), 1, 0)), 0) AS 4WeeksTotal,
6969 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), 1, 0)), 0) AS 4WeeksValid,
7070 IFNULL(SUM(IF(confirmations = -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), 1, 0)), 0) AS 4WeeksOrphan,
7171 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), difficulty, 0)), 0) AS 4WeeksDifficulty,
72- IFNULL(ROUND( SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), shares, 0) )), 0) AS 4WeeksShares,
72+ IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), shares, 0)), 0) AS 4WeeksShares,
7373 IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 2419200 SECOND), amount, 0)), 0) AS 4WeeksAmount,
7474 IFNULL(SUM(IF(FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), 1, 0)), 0) AS 12MonthTotal,
7575 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), 1, 0)), 0) AS 12MonthValid,
7676 IFNULL(SUM(IF(confirmations = -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), 1, 0)), 0) AS 12MonthOrphan,
7777 IFNULL(SUM(IF(confirmations > 0 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), difficulty, 0)), 0) AS 12MonthDifficulty,
78- IFNULL(ROUND( SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), shares, 0) )), 0) AS 12MonthShares,
78+ IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), shares, 0)), 0) AS 12MonthShares,
7979 IFNULL(SUM(IF(confirmations > -1 AND FROM_UNIXTIME(time) >= DATE_SUB(now(), INTERVAL 29030400 SECOND), amount, 0)), 0) AS 12MonthAmount
8080 FROM " . $ this ->block ->getTableName ());
8181 if ($ this ->checkStmt ($ stmt ) && $ stmt ->execute () && $ result = $ stmt ->get_result ()) {
@@ -104,7 +104,7 @@ public function getBlocksFound($limit=10) {
104104 b.*,
105105 a.username AS finder,
106106 a.is_anonymous AS is_anonymous,
107- ROUND(difficulty * POW(2, 32 - " . $ this ->coin ->getTargetBits () . "), 0) AS estshares
107+ ROUND(difficulty * POW(2, 32 - " . $ this ->coin ->getTargetBits () . "), 0), 4) AS estshares
108108 FROM " . $ this ->block ->getTableName () . " AS b
109109 LEFT JOIN " . $ this ->user ->getTableName () . " AS a
110110 ON b.account_id = a.id
@@ -127,7 +127,7 @@ public function getBlocksFoundHeight($iHeight=0, $limit=10) {
127127 b.*,
128128 a.username AS finder,
129129 a.is_anonymous AS is_anonymous,
130- ROUND(difficulty * POW(2, 32 - " . $ this ->coin ->getTargetBits () . "), 0 ) AS estshares
130+ ROUND(difficulty * POW(2, 32 - " . $ this ->coin ->getTargetBits () . "), 4 ) AS estshares
131131 FROM " . $ this ->block ->getTableName () . " AS b
132132 LEFT JOIN " . $ this ->user ->getTableName () . " AS a
133133 ON b.account_id = a.id
@@ -163,7 +163,7 @@ public function getBlocksSolvedbyAccount($limit=25) {
163163 return $ this ->memcache ->setCache (__FUNCTION__ . $ limit , $ result ->fetch_all (MYSQLI_ASSOC ), 5 );
164164 return $ this ->sqlError ();
165165 }
166-
166+
167167 /**
168168 * Get SUM of blocks found and generated Coins for each worker
169169 * @param limit int Last limit blocks
@@ -185,7 +185,7 @@ public function getBlocksSolvedbyWorker($account_id, $limit=25) {
185185 return $ this ->memcache ->setCache (__FUNCTION__ . $ account_id . $ limit , $ result ->fetch_all (MYSQLI_ASSOC ), 5 );
186186 return $ this ->sqlError ();
187187 }
188-
188+
189189 /**
190190 * Currently the only function writing to the database
191191 * Stored per block user statistics of valid and invalid shares
@@ -293,8 +293,8 @@ public function getRoundShares() {
293293 }
294294 $ stmt = $ this ->mysqli ->prepare ("
295295 SELECT
296- ROUND( IFNULL(SUM(IF(our_result='Y', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0 ), 0) AS valid,
297- ROUND( IFNULL(SUM(IF(our_result='N', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0 ), 0) AS invalid
296+ IFNULL(SUM(IF(our_result='Y', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0) AS valid,
297+ IFNULL(SUM(IF(our_result='N', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0) AS invalid
298298 FROM " . $ this ->share ->getTableName () . "
299299 WHERE UNIX_TIMESTAMP(time) > IFNULL((SELECT MAX(time) FROM " . $ this ->block ->getTableName () . "), 0) " );
300300 if ( $ this ->checkStmt ($ stmt ) && $ stmt ->execute () && $ result = $ stmt ->get_result () )
@@ -316,8 +316,8 @@ public function getAllUserShares() {
316316 }
317317 $ stmt = $ this ->mysqli ->prepare ("
318318 SELECT
319- ROUND( IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), s.difficulty), 0)), 0 ), 0) AS valid,
320- ROUND( IFNULL(SUM(IF(our_result='N', IF(s.difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), s.difficulty), 0)), 0 ), 0) AS invalid,
319+ IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), s.difficulty), 0)), 0) AS valid,
320+ IFNULL(SUM(IF(our_result='N', IF(s.difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), s.difficulty), 0)), 0) AS invalid,
321321 u.id AS id,
322322 u.donate_percent AS donate_percent,
323323 u.is_anonymous AS is_anonymous,
@@ -368,11 +368,11 @@ public function getUserShares($username, $account_id=NULL) {
368368 if ($ data = $ this ->memcache ->get (__FUNCTION__ . $ account_id )) return $ data ;
369369 $ stmt = $ this ->mysqli ->prepare ("
370370 SELECT
371- ROUND( IFNULL(SUM(IF(our_result='Y', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0 ), 0) AS valid,
372- ROUND( IFNULL(SUM(IF(our_result='N', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0 ), 0) AS invalid
371+ IFNULL(SUM(IF(our_result='Y', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0) AS valid,
372+ IFNULL(SUM(IF(our_result='N', IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty), 0)), 0) AS invalid
373373 FROM " . $ this ->share ->getTableName () . "
374374 WHERE username LIKE ?
375- AND UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(b.time) FROM " . $ this ->block ->getTableName () . " AS b),0) " );
375+ AND UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(b.time) FROM " . $ this ->block ->getTableName () . " AS b),0) " );
376376 $ username = $ username . ".% " ;
377377 if ($ stmt && $ stmt ->bind_param ("s " , $ username ) && $ stmt ->execute () && $ result = $ stmt ->get_result ())
378378 return $ this ->memcache ->setCache (__FUNCTION__ . $ account_id , $ result ->fetch_assoc ());
@@ -500,7 +500,7 @@ public function getUserUnpaidPPSShares($username, $account_id=NULL, $last_paid_p
500500 if ($ this ->getGetCache () && $ data = $ this ->memcache ->get (__FUNCTION__ . $ account_id )) return $ data ;
501501 $ stmt = $ this ->mysqli ->prepare ("
502502 SELECT
503- ROUND( IFNULL(SUM(IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty)), 0 ), 0) AS total
503+ IFNULL(SUM(IF(difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), difficulty)), 0) AS total
504504 FROM " . $ this ->share ->getTableName () . "
505505 WHERE username LIKE ?
506506 AND id > ?
@@ -603,7 +603,7 @@ public function getTopContributors($type='shares', $limit=15) {
603603 a.username AS account,
604604 a.donate_percent AS donate_percent,
605605 a.is_anonymous AS is_anonymous,
606- ROUND( IFNULL(SUM(IF(s.difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), s.difficulty)), 0 ), 0) AS shares
606+ IFNULL(SUM(IF(s.difficulty=0, POW(2, ( " . $ this ->config ['difficulty ' ] . " - 16)), s.difficulty)), 0) AS shares
607607 FROM " . $ this ->share ->getTableName () . " AS s
608608 LEFT JOIN " . $ this ->user ->getTableName () . " AS a
609609 ON SUBSTRING_INDEX( s.username, '.', 1 ) = a.username
@@ -744,7 +744,7 @@ public function getUserEstimates($value1, $value2, $dDonate, $bNoFees, $ppsvalue
744744 if ($ this ->config ['payout_system ' ] != 'pps ' ) {
745745 if (@$ value1 ['valid ' ] > 0 && @$ value2 ['valid ' ] > 0 ) {
746746 $ this ->config ['reward_type ' ] == 'fixed ' ? $ reward = $ this ->config ['reward ' ] : $ reward = $ this ->block ->getAverageAmount ();
747- $ aEstimates ['block ' ] = round (( (int )$ value2 ['valid ' ] / (int )$ value1 ['valid ' ] ) * (float )$ reward , 8 );
747+ $ aEstimates ['block ' ] = round (( (float )$ value2 ['valid ' ] / (float )$ value1 ['valid ' ] ) * (float )$ reward , 8 );
748748 $ bNoFees == 0 ? $ aEstimates ['fee ' ] = round (((float )$ this ->config ['fees ' ] / 100 ) * (float )$ aEstimates ['block ' ], 8 ) : $ aEstimates ['fee ' ] = 0 ;
749749 $ aEstimates ['donation ' ] = round ((( (float )$ dDonate / 100 ) * ((float )$ aEstimates ['block ' ] - (float )$ aEstimates ['fee ' ])), 8 );
750750 $ aEstimates ['payout ' ] = round ((float )$ aEstimates ['block ' ] - (float )$ aEstimates ['donation ' ] - (float )$ aEstimates ['fee ' ], 8 );
@@ -789,7 +789,7 @@ public function getPoolStatsHours($hour=24) {
789789 SELECT
790790 IFNULL(COUNT(id), 0) as count,
791791 IFNULL(AVG(difficulty), 0) as average,
792- IFNULL(ROUND( SUM(shares) ), 0) as shares,
792+ IFNULL(SUM(shares), 0) as shares,
793793 IFNULL(SUM(amount), 0) as rewards
794794 FROM " . $ this ->block ->getTableName () . "
795795 WHERE FROM_UNIXTIME(time) > DATE_SUB(now(), INTERVAL ? HOUR)
0 commit comments