[FIX] Display issues on SHA coins

* [FIX] Estimated shares on various places
* [ADDED] Calculate estimated shares based on network diff in stats
  class
* [UPDATED] Themes updated as needed

Fixes #819 once merged
This commit is contained in:
Sebastian Grewe 2013-11-04 17:28:03 +01:00
parent 556e02024f
commit 4e68de0e5a
7 changed files with 15 additions and 6 deletions

View File

@ -759,7 +759,7 @@ class Statistics {
SELECT
IFNULL(COUNT(id), 0) as count,
IFNULL(AVG(difficulty), 0) as average,
IFNULL(ROUND(SUM((difficulty * 65536) / POW(2, (" . $this->config['difficulty'] . " -16))), 0), 0) AS expected,
IFNULL(ROUND(SUM((POW(2, ( 32 - " . $this->config['target_bits'] . " )) * difficulty) / POW(2, (" . $this->config['difficulty'] . " -16))), 0), 0) AS expected,
IFNULL(ROUND(SUM(shares)), 0) as shares,
IFNULL(SUM(amount), 0) as rewards
FROM " . $this->block->getTableName() . "
@ -772,6 +772,14 @@ class Statistics {
return false;
}
/**
* Caclulate estimated shares based on network difficulty and pool difficulty
* @param dDiff double Network difficulty
* @return shares integer Share count
**/
public function getEstimatedShares($dDiff) {
return round((POW(2, (32 - $this->config['target_bits'])) * $dDiff) / pow(2, ($this->config['difficulty'] - 16)));
}
}

View File

@ -80,7 +80,7 @@ $aWorkers = $worker->getWorkers($user_id, $interval);
$aPrice = $setting->getValue('price');
// Round progress
$iEstShares = round((65536 * $dDifficulty) / pow(2, ($config['difficulty'] - 16)));
$iEstShares = $statistics->getEstimatedShares($dDifficulty);
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
// Output JSON format

View File

@ -44,7 +44,7 @@ if ($iTotalRoundShares > 0) {
}
// Round progress
$iEstShares = round((65536 * $dDifficulty) / pow(2, ($config['difficulty'] - 16)));
$iEstShares = $statistics->getEstimatedShares($dDifficulty);
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
// Output JSON format

View File

@ -65,6 +65,7 @@ $aGlobal = array(
'price' => $setting->getValue('price'),
'disable_mp' => $setting->getValue('disable_mp'),
'config' => array(
'target_bits' => $config['target_bits'],
'accounts' => $config['accounts'],
'disable_invitations' => $setting->getValue('disable_invitations'),
'disable_notifications' => $setting->getValue('disable_notifications'),

View File

@ -131,7 +131,7 @@ target and network difficulty and assuming a zero variance scenario.
<td class="right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="right">
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares estshares=$BLOCKSFOUND[block].estshares}
{assign var="totalpercentage" value=$totalpercentage+$percentage}
{assign var="totalpercentage" value=$totalpercentage+$percentage}
<font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font>
</td>
</tr>

View File

@ -48,7 +48,7 @@
</tr>
<tr>
<td class="leftheader">Est. Shares this Round</td>
{assign var=estshares value=(65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16))}
{assign var=estshares value=(pow(2, (32 - $GLOBAL.config.target_bits)) * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16))}
<td>{$estshares|number_format:"0"} <font size="1">(done: {(100 / $estshares * $GLOBAL.roundshares.valid)|number_format:"2"} %)</td>
</tr>
<tr>

View File

@ -13,7 +13,7 @@
<tr>
<th scope="row">Expected</th>
{section block $BLOCKSFOUND step=-1}
<td>{round(pow(2,32 - $GLOBAL.config.targetdiff) * $BLOCKSFOUND[block].difficulty)}</td>
<td>{$BLOCKSFOUND[block].estshares}</td>
{/section}
</tr>
<tr>