[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:
parent
556e02024f
commit
4e68de0e5a
@ -759,7 +759,7 @@ class Statistics {
|
|||||||
SELECT
|
SELECT
|
||||||
IFNULL(COUNT(id), 0) as count,
|
IFNULL(COUNT(id), 0) as count,
|
||||||
IFNULL(AVG(difficulty), 0) as average,
|
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(ROUND(SUM(shares)), 0) as shares,
|
||||||
IFNULL(SUM(amount), 0) as rewards
|
IFNULL(SUM(amount), 0) as rewards
|
||||||
FROM " . $this->block->getTableName() . "
|
FROM " . $this->block->getTableName() . "
|
||||||
@ -772,6 +772,14 @@ class Statistics {
|
|||||||
return false;
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,7 @@ $aWorkers = $worker->getWorkers($user_id, $interval);
|
|||||||
$aPrice = $setting->getValue('price');
|
$aPrice = $setting->getValue('price');
|
||||||
|
|
||||||
// Round progress
|
// Round progress
|
||||||
$iEstShares = round((65536 * $dDifficulty) / pow(2, ($config['difficulty'] - 16)));
|
$iEstShares = $statistics->getEstimatedShares($dDifficulty);
|
||||||
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
|
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
|
||||||
|
|
||||||
// Output JSON format
|
// Output JSON format
|
||||||
|
|||||||
@ -44,7 +44,7 @@ if ($iTotalRoundShares > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Round progress
|
// Round progress
|
||||||
$iEstShares = round((65536 * $dDifficulty) / pow(2, ($config['difficulty'] - 16)));
|
$iEstShares = $statistics->getEstimatedShares($dDifficulty);
|
||||||
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
|
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
|
||||||
|
|
||||||
// Output JSON format
|
// Output JSON format
|
||||||
|
|||||||
@ -65,6 +65,7 @@ $aGlobal = array(
|
|||||||
'price' => $setting->getValue('price'),
|
'price' => $setting->getValue('price'),
|
||||||
'disable_mp' => $setting->getValue('disable_mp'),
|
'disable_mp' => $setting->getValue('disable_mp'),
|
||||||
'config' => array(
|
'config' => array(
|
||||||
|
'target_bits' => $config['target_bits'],
|
||||||
'accounts' => $config['accounts'],
|
'accounts' => $config['accounts'],
|
||||||
'disable_invitations' => $setting->getValue('disable_invitations'),
|
'disable_invitations' => $setting->getValue('disable_invitations'),
|
||||||
'disable_notifications' => $setting->getValue('disable_notifications'),
|
'disable_notifications' => $setting->getValue('disable_notifications'),
|
||||||
|
|||||||
@ -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">{$BLOCKSFOUND[block].shares|number_format}</td>
|
||||||
<td class="right">
|
<td class="right">
|
||||||
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares estshares=$BLOCKSFOUND[block].estshares}
|
{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>
|
<font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="leftheader">Est. Shares this Round</td>
|
<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>
|
<td>{$estshares|number_format:"0"} <font size="1">(done: {(100 / $estshares * $GLOBAL.roundshares.valid)|number_format:"2"} %)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Expected</th>
|
<th scope="row">Expected</th>
|
||||||
{section block $BLOCKSFOUND step=-1}
|
{section block $BLOCKSFOUND step=-1}
|
||||||
<td>{round(pow(2,32 - $GLOBAL.config.targetdiff) * $BLOCKSFOUND[block].difficulty)}</td>
|
<td>{$BLOCKSFOUND[block].estshares}</td>
|
||||||
{/section}
|
{/section}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user