Display network hashrate in public API

Instead of 0 show the actual hashrate, still shows 0 if unable to
connect to RPC server.

Fixes #511
This commit is contained in:
Sebastian Grewe 2013-07-24 09:12:29 +02:00
parent 6a04666ec3
commit c7f952a27a

View File

@ -10,6 +10,9 @@ $api->isActive();
$aLastBlock = $block->getLast();
$aShares = $statistics->getRoundShares();
// RPC Calls
$bitcoin->can_connect() === true ? $dNetworkHashrate = $bitcoin->query('getnetworkhashps') : $dNetworkHashrate = 0;
echo json_encode(
array(
'pool_name' => $config['website']['name'],
@ -17,7 +20,7 @@ echo json_encode(
'workers' => $worker->getCountAllActiveWorkers(),
'shares_this_round' => $aShares['valid'],
'last_block' => $aLastBlock['height'],
'network_hashrate' => '0'
'network_hashrate' => $dNetworkHashrate
)
);