removed debug output, added time to find next block

This commit is contained in:
Sebastian Grewe 2013-05-14 00:08:12 +02:00
parent e316622327
commit 36cda9b629

View File

@ -30,7 +30,6 @@ if (!$aHashData = $memcache->get('aHashData')) {
WHERE time > DATE_SUB(now(), INTERVAL 10 MINUTE)
GROUP BY account
ORDER BY hashrate DESC LIMIT 15");
echo $mysqli->error;
$stmt->execute();
$hashrates= $stmt->get_result();
$aHashData = $hashrates->fetch_all(MYSQLI_ASSOC);
@ -38,7 +37,6 @@ echo $mysqli->error;
$memcache->set('aHashData', $aHashData, 60);
}
if (! $aContributerData = $memcache->get('aContributerData') ) {
// Top 15 Contributers
$stmt = $mysqli->prepare("SELECT count(id) AS shares, SUBSTRING_INDEX( `username` , '.', 1 ) AS account FROM shares GROUP BY account ORDER BY shares DESC LIMIT 15");
@ -64,7 +62,12 @@ $aBlocksFoundData = $blocksfound->fetch_all(MYSQLI_ASSOC);
$stmt->close();
// Estimated time to find the next block
$iEstTime = (($dDifficulty * bcpow(2,$config['difficulty'])) / ( $settings->getValue('currenthashrate') * 1000));
if (!$iCurrentPoolHashrate = $memcache->get('iCurrentPoolHashrate')) {
$debug->append('Fetching iCurrentPoolHashrate from database');
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();
$memcache->set('iCurrentPoolHashrate', $iCurrentPoolHashrate, 60);
}
$iEstTime = (($dDifficulty * bcpow(2,$config['difficulty'])) / $iCurrentPoolHashrate);
$now = new DateTime( "now" );
if (!empty($aBlockData)) {
$dTimeSinceLast = ($now->getTimestamp() - $aBlockData['time']);