Adding support for POS coin

This will fix #275 and add proper support for a different implementation
of network difficulty.
This commit is contained in:
Sebastian Grewe 2013-06-30 10:26:24 +02:00
parent 4c04142f45
commit af70a194c9
5 changed files with 13 additions and 2 deletions

View File

@ -32,6 +32,8 @@ 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')
$dDifficulty = $dDifficulty['proof-of-work'];
} else {
verbose("Aborted: " . $bitcoin->can_connect() . "\n");
exit(1);

View File

@ -10,8 +10,10 @@ $id = $user->checkApiKey($_REQUEST['api_key']);
// Fetch data from litecoind
if ($bitcoin->can_connect() === true){
if (!$dDifficulty = $memcache->get('dDifficulty')) {
$memcache->set('dDifficulty', $dDifficulty);
$dDifficulty = $bitcoin->query('getdifficulty');
if (strtolower($config['currency']) == 'pos')
$dDifficulty = $dDifficulty['proof-of-work'];
$memcache->set('dDifficulty', $dDifficulty);
}
} else {
$iDifficulty = 1;

View File

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

View File

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

View File

@ -14,8 +14,11 @@ $aRoundShares = 1;
// Only run these if the user is logged in
if (@$_SESSION['AUTHENTICATED']) {
$aRoundShares = $statistics->getRoundShares();
if ($bitcoin->can_connect() === true)
if ($bitcoin->can_connect() === true) {
$dDifficulty = $bitcoin->query('getdifficulty');
if (strtolower($config['currency']) == 'pos')
$dDifficulty = $dDifficulty['proof-of-work'];
}
}
// Fetch some data