From 5966f77e761ef05eee4c1f02fe6fb0d6d82a67bb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 27 Feb 2014 12:13:56 +0100 Subject: [PATCH] [ADDED] Hashrate modifier name and value * [ADDED] Hashrate modifier value to getnavbardata * [ADDED] Hashrate modifier name to getnavbardata Fixes #1845 once merged. --- public/include/pages/api/getnavbardata.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/include/pages/api/getnavbardata.inc.php b/public/include/pages/api/getnavbardata.inc.php index f043a7c1..aa83986e 100644 --- a/public/include/pages/api/getnavbardata.inc.php +++ b/public/include/pages/api/getnavbardata.inc.php @@ -37,6 +37,9 @@ $dPoolHashrate = $statistics->getCurrentHashrate($interval); if ($dPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $dPoolHashrate; $statistics->setGetCache(true); +// Small helper +$aHashunits = array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ); + // Apply pool modifiers $dPoolHashrateAdjusted = $dPoolHashrate * $dPoolHashrateModifier; $dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier; @@ -63,8 +66,8 @@ if ($iEstShares > 0 && $aRoundShares['valid'] > 0) { // Output JSON format $data = array( 'raw' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'pool' => array( 'hashrate' => $dPoolHashrate ) ), - 'pool' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'hashrate' => $dPoolHashrateAdjusted, 'estimated' => $iEstShares, 'progress' => $dEstPercent ), - 'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ), + 'pool' => array( 'hashratemodifiername' => $aHashunits[$dPoolHashrateModifier], 'hashratemodifier' => $dPoolHashrateModifier, 'workers' => $worker->getCountAllActiveWorkers(), 'hashrate' => $dPoolHashrateAdjusted, 'estimated' => $iEstShares, 'progress' => $dEstPercent ), + 'network' => array( 'hashratemodifiername' => $aHashunits[$dNetworkHashrateModifier], 'hashratemodifier' => $dNetworkHashrateModifier, 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ), ); echo $api->get_json($data);