use bitcoin wrapper method for getdiff calls

This commit is contained in:
Sebastian Grewe 2013-09-17 09:42:41 +02:00
parent af21cafea5
commit baaf743218
4 changed files with 2 additions and 13 deletions

View File

@ -11,12 +11,7 @@ $id = $user->checkApiKey($_REQUEST['api_key']);
// Fetch data from wallet
if ($bitcoin->can_connect() === true){
if (!$dDifficulty = $memcache->get('dDifficulty')) {
$dDifficulty = $bitcoin->query('getdifficulty');
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$memcache->set('dDifficulty', $dDifficulty);
}
$dDifficulty = $bitcoin->getdifficulty();
} else {
$iDifficulty = 1;
}

View File

@ -19,8 +19,6 @@ $aShares['valid'] > 0 ? $dEfficiency = round((100 - (100 / $aShares['valid'] * $
// Fetch RPC data
if ($bitcoin->can_connect() === true){
$dDifficulty = $bitcoin->getdifficulty();
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$iBlock = $bitcoin->getblockcount();
} else {
$dDifficulty = 1;

View File

@ -7,9 +7,7 @@ if (!defined('SECURITY'))
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$debug->append('No cached version available, fetching from backend', 3);
if ($bitcoin->can_connect() === true){
$dDifficulty = $bitcoin->query('getdifficulty');
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$dDifficulty = $bitcoin->getdifficulty();
$iBlock = $bitcoin->query('getblockcount');
} else {
$dDifficulty = 1;

View File

@ -8,8 +8,6 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
// Fetch data from wallet
if ($bitcoin->can_connect() === true){
$dDifficulty = $bitcoin->getdifficulty();
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$iBlock = $bitcoin->getblockcount();
is_int($iBlock) && $iBlock > 0 ? $sBlockHash = $bitcoin->query('getblockhash', $iBlock) : $sBlockHash = '';
} else {