Detect if we use POS difficulties or not

Fixes #275
This commit is contained in:
Sebastian Grewe 2013-06-30 19:31:07 +02:00
parent af70a194c9
commit 4be963d7be
5 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ if ($config['payout_system'] != 'pps') {
// Fetch all transactions since our last block
if ( $bitcoin->can_connect() === true ){
$dDifficulty = $bitcoin->getdifficulty();
if (strtolower($config['currency']) == 'pos')
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
} else {
verbose("Aborted: " . $bitcoin->can_connect() . "\n");

View File

@ -11,7 +11,7 @@ $id = $user->checkApiKey($_REQUEST['api_key']);
if ($bitcoin->can_connect() === true){
if (!$dDifficulty = $memcache->get('dDifficulty')) {
$dDifficulty = $bitcoin->query('getdifficulty');
if (strtolower($config['currency']) == 'pos')
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$memcache->set('dDifficulty', $dDifficulty);
}

View File

@ -6,7 +6,7 @@ if (!defined('SECURITY'))
if ($bitcoin->can_connect() === true){
$dDifficulty = $bitcoin->query('getdifficulty');
if (strtolower($config['currency']) == 'pos')
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$iBlock = $bitcoin->query('getblockcount');
} else {

View File

@ -7,7 +7,7 @@ if (!defined('SECURITY'))
// Fetch data from litecoind
if ($bitcoin->can_connect() === true){
$dDifficulty = $bitcoin->getdifficulty();
if (strtolower($config['currency']) == 'pos')
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
$iBlock = $bitcoin->getblockcount();
} else {

View File

@ -16,7 +16,7 @@ if (@$_SESSION['AUTHENTICATED']) {
$aRoundShares = $statistics->getRoundShares();
if ($bitcoin->can_connect() === true) {
$dDifficulty = $bitcoin->query('getdifficulty');
if (strtolower($config['currency']) == 'pos')
if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty))
$dDifficulty = $dDifficulty['proof-of-work'];
}
}