added "Est. Next Difficulty" and "Avg. Time per Round" to dashboard and dashboard api
This commit is contained in:
parent
a407f964d7
commit
f09459433b
@ -104,9 +104,12 @@ if ($iEstShares > 0 && $aRoundShares['valid'] > 0) {
|
||||
$dEstPercent = 0;
|
||||
}
|
||||
|
||||
$dExpectedTimePerBlock = pow(2, $config['target_bits']) * $dDifficulty / $dNetworkHashrate;
|
||||
$dEstNextDifficulty = round($dDifficulty * $config['cointarget'] / $dExpectedTimePerBlock, 8);
|
||||
|
||||
// Output JSON format
|
||||
$data = array(
|
||||
'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000 ) ),
|
||||
'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000, 'esttimeperblock' => $dExpectedTimePerBlock, 'nextdifficulty' => $dEstNextDifficulty ) ),
|
||||
'personal' => array (
|
||||
'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'sharedifficulty' => $dPersonalShareDifficulty,
|
||||
'shares' => array('valid' => $aUserRoundShares['valid'], 'invalid' => $aUserRoundShares['invalid'], 'invalid_percent' => $dUserInvalidPercent, 'unpaid' => $dUnpaidShares ),
|
||||
|
||||
@ -35,11 +35,14 @@ if ($user->isAuthenticated()) {
|
||||
// Avoid confusion, ensure our nethash isn't higher than poolhash
|
||||
if ($iCurrentPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $iCurrentPoolHashrate;
|
||||
|
||||
$dExpectedTimePerBlock = pow(2, $config['target_bits']) * $dDifficulty / $dNetworkHashrate;
|
||||
$dEstNextDifficulty = round($dDifficulty * $config['cointarget'] / $dExpectedTimePerBlock, 8);
|
||||
|
||||
// Make it available in Smarty
|
||||
$smarty->assign('DISABLED_DASHBOARD', $setting->getValue('disable_dashboard'));
|
||||
$smarty->assign('DISABLED_DASHBOARD_API', $setting->getValue('disable_dashboard_api'));
|
||||
$smarty->assign('ESTIMATES', array('shares' => $iEstShares, 'percent' => $dEstPercent));
|
||||
$smarty->assign('NETWORK', array('difficulty' => $dDifficulty, 'block' => $iBlock));
|
||||
$smarty->assign('NETWORK', array('difficulty' => $dDifficulty, 'block' => $iBlock, 'EstNextDifficulty' => $dEstNextDifficulty, 'EstTimePerBlock' => $dExpectedTimePerBlock));
|
||||
$smarty->assign('INTERVAL', $interval / 60);
|
||||
$smarty->assign('CONTENT', 'default.tpl');
|
||||
}
|
||||
|
||||
@ -52,8 +52,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
$dEstPercent = 0;
|
||||
}
|
||||
|
||||
$dExpectedTimePerBlock = pow(2,32) * $dDifficulty / $dNetworkHashrate;
|
||||
$dEstNextDifficulty = round($dDifficulty * 60 / $dExpectedTimePerBlock, 8);
|
||||
$dExpectedTimePerBlock = pow(2, $config['target_bits']) * $dDifficulty / $dNetworkHashrate;
|
||||
$dEstNextDifficulty = round($dDifficulty * $config['cointarget'] / $dExpectedTimePerBlock, 8);
|
||||
|
||||
// Propagate content our template
|
||||
$smarty->assign("ESTTIME", $iEstTime);
|
||||
@ -64,7 +64,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
$smarty->assign("CONTRIBHASHES", $aContributorsHashes);
|
||||
$smarty->assign("CURRENTBLOCK", $iBlock);
|
||||
$smarty->assign("CURRENTBLOCKHASH", @$sBlockHash);
|
||||
$smarty->assign('NETWORK', array('difficulty' => $dDifficulty, 'block' => $iBlock, 'EstNextDifficulty' => $dEstNextDifficulty, 'ExpectedTimePerBlock' => $dExpectedTimePerBlock));
|
||||
$smarty->assign('NETWORK', array('difficulty' => $dDifficulty, 'block' => $iBlock, 'EstNextDifficulty' => $dEstNextDifficulty, 'EstTimePerBlock' => $dExpectedTimePerBlock));
|
||||
$smarty->assign('ESTIMATES', array('shares' => $iEstShares, 'percent' => $dEstPercent));
|
||||
if (count($aBlockData) > 0) {
|
||||
$smarty->assign("LASTBLOCK", $aBlockData['height']);
|
||||
|
||||
@ -140,6 +140,8 @@ $(document).ready(function(){
|
||||
$('#b-pvalid').html(data.getdashboarddata.data.pool.shares.valid);
|
||||
$('#b-pivalid').html(data.getdashboarddata.data.pool.shares.invalid + " (" + data.getdashboarddata.data.pool.shares.invalid_percent + "%)" );
|
||||
$('#b-diff').html(data.getdashboarddata.data.network.difficulty);
|
||||
$('#b-nextdiff').html(data.getdashboarddata.data.network.nextdifficulty);
|
||||
$('#b-esttimeperblock').html(data.getdashboarddata.data.network.esttimeperblock + " seconds"); // <- this needs some nicer format
|
||||
$('#b-nblock').html(data.getdashboarddata.data.network.block);
|
||||
$('#b-target').html(data.getdashboarddata.data.pool.shares.estimated + " (done: " + data.getdashboarddata.data.pool.shares.progress + "%)" );
|
||||
{/literal}{if $GLOBAL.config.payout_system != 'pps'}{literal }
|
||||
|
||||
@ -5,6 +5,14 @@
|
||||
<td><b>Difficulty</b></td>
|
||||
<td id="b-diff" class="right">{$NETWORK.difficulty}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Est Next Difficulty</b></td>
|
||||
<td id="b-nextdiff" class="right">{$NETWORK.EstNextDifficulty}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Est. Avg. Time per Block</b></td>
|
||||
<td id="b-esttimeperblock" class="right">{$NETWORK.EstTimePerBlock|seconds_to_words}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Current Block</b></td>
|
||||
<td id="b-nblock" class="right">{$NETWORK.block}</td>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">Est. Avg. Time per Round (Network)</td>
|
||||
<td><font size="2"><span id="b-diff">{$NETWORK.ExpectedTimePerBlock|seconds_to_words}</span></font></td>
|
||||
<td><font size="2"><span id="b-diff">{$NETWORK.EstTimePerBlock|seconds_to_words}</span></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">Est. Avg. Time per Round (Pool)</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user