adding network hashrate to poolstatus
This commit is contained in:
parent
522e37717b
commit
f35c7cedc8
@ -22,14 +22,19 @@ if ($bitcoin->can_connect() === true){
|
|||||||
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
|
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
|
||||||
$dDifficulty = $dDifficulty['proof-of-work'];
|
$dDifficulty = $dDifficulty['proof-of-work'];
|
||||||
$iBlock = $bitcoin->getblockcount();
|
$iBlock = $bitcoin->getblockcount();
|
||||||
|
$dNetworkHashrate = $bitcoin->query('getnetworkhashps');
|
||||||
} else {
|
} else {
|
||||||
$dDifficulty = 1;
|
$dDifficulty = 1;
|
||||||
$iBlock = 0;
|
$iBlock = 0;
|
||||||
|
$dNetworkHashrate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Estimated time to find the next block
|
// Estimated time to find the next block
|
||||||
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();
|
$iCurrentPoolHashrate = $statistics->getCurrentHashrate();
|
||||||
|
|
||||||
|
// Avoid confusion, ensure our nethash isn't higher than poolhash
|
||||||
|
if ($iCurrentPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $iCurrentPoolHashrate;
|
||||||
|
|
||||||
// Time in seconds, not hours, using modifier in smarty to translate
|
// Time in seconds, not hours, using modifier in smarty to translate
|
||||||
$iCurrentPoolHashrate > 0 ? $iEstTime = $dDifficulty * pow(2,32) / ($iCurrentPoolHashrate * 1000) : $iEstTime = 0;
|
$iCurrentPoolHashrate > 0 ? $iEstTime = $dDifficulty * pow(2,32) / ($iCurrentPoolHashrate * 1000) : $iEstTime = 0;
|
||||||
$iEstShares = (pow(2, 32 - $config['difficulty']) * $dDifficulty);
|
$iEstShares = (pow(2, 32 - $config['difficulty']) * $dDifficulty);
|
||||||
@ -56,6 +61,7 @@ echo json_encode(
|
|||||||
'esttime' => $iEstTime,
|
'esttime' => $iEstTime,
|
||||||
'estshares' => $iEstShares,
|
'estshares' => $iEstShares,
|
||||||
'timesincelast' => $dTimeSinceLast,
|
'timesincelast' => $dTimeSinceLast,
|
||||||
|
'nethashrate' => $dNetworkHashrate
|
||||||
)));
|
)));
|
||||||
|
|
||||||
// Supress master template
|
// Supress master template
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user