Merge pull request #341 from TheSerapher/issue-308
Adding dynamic block value support in PPS
This commit is contained in:
commit
3ab9d5252f
@ -63,6 +63,7 @@ if (empty($aTransactions['transactions'])) {
|
|||||||
verbose("Failed" . "\n");
|
verbose("Failed" . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,16 @@ if ( $bitcoin->can_connect() === true ){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Value per share calculation
|
// Value per share calculation
|
||||||
$pps_value = number_format(round(50 / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
if ($config['reward_type'] != 'block') {
|
||||||
|
$pps_value = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
||||||
|
} else {
|
||||||
|
// Try to find the last block value and use that for future payouts, revert to fixed reward if none found
|
||||||
|
if ($aLastBlock = $block->getLast()) {
|
||||||
|
$pps_value = number_format(round($aLastBlock['amount'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
||||||
|
} else {
|
||||||
|
$pps_value = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find our last share accounted and last inserted share for PPS calculations
|
// Find our last share accounted and last inserted share for PPS calculations
|
||||||
$iPreviousShareId = $setting->getValue('pps_last_share_id');
|
$iPreviousShareId = $setting->getValue('pps_last_share_id');
|
||||||
|
|||||||
@ -177,12 +177,33 @@ $config['difficulty'] = 20;
|
|||||||
/**
|
/**
|
||||||
* This defines how rewards are paid to users.
|
* This defines how rewards are paid to users.
|
||||||
*
|
*
|
||||||
|
* Explanation:
|
||||||
|
*
|
||||||
|
* Proportional Payout System
|
||||||
|
* When running a pool on fixed mode, each block will be paid
|
||||||
|
* out as defined in `reward`. If you wish to pass transaction
|
||||||
|
* fees inside discovered blocks on to user, set this to `block`.
|
||||||
|
* This is really helpful for altcoins with dynamic block values!
|
||||||
|
*
|
||||||
|
* PPS Payout System
|
||||||
|
* If set to `fixed`, all PPS values are based on the `reward` setting.
|
||||||
|
* If you set it to `block` you will calculate the current round based
|
||||||
|
* on the previous block value. The idea is to pass the block of the
|
||||||
|
* last round on to the users. If no previous block is found, PPS value
|
||||||
|
* will fall back to the fixed value set in `reward`. Ensure you don't
|
||||||
|
* overpay users in the first round!
|
||||||
|
*
|
||||||
* Available options:
|
* Available options:
|
||||||
|
* reward_type:
|
||||||
* fixed : Fixed value according to `reward` setting
|
* fixed : Fixed value according to `reward` setting
|
||||||
* block : Dynamic value based on block amount
|
* block : Dynamic value based on block amount
|
||||||
|
* reward:
|
||||||
|
* float value : Any value of your choice but should reflect base block values
|
||||||
*
|
*
|
||||||
* Default:
|
* Default:
|
||||||
* fixed
|
* reward_type = `fixed`
|
||||||
|
* reward = 50
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
$config['reward_type'] = 'fixed';
|
$config['reward_type'] = 'fixed';
|
||||||
$config['reward'] = 50;
|
$config['reward'] = 50;
|
||||||
|
|||||||
@ -36,7 +36,6 @@ $aGlobal = array(
|
|||||||
'hashrate' => $iCurrentPoolHashrate,
|
'hashrate' => $iCurrentPoolHashrate,
|
||||||
'nethashrate' => $dNetworkHashrate,
|
'nethashrate' => $dNetworkHashrate,
|
||||||
'sharerate' => $iCurrentPoolShareRate,
|
'sharerate' => $iCurrentPoolShareRate,
|
||||||
'ppsvalue' => number_format(round(50 / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12),
|
|
||||||
'workers' => $iCurrentActiveWorkers,
|
'workers' => $iCurrentActiveWorkers,
|
||||||
'roundshares' => $aRoundShares,
|
'roundshares' => $aRoundShares,
|
||||||
'fees' => $config['fees'],
|
'fees' => $config['fees'],
|
||||||
@ -59,6 +58,18 @@ $aGlobal = array(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Special calculations for PPS Values based on reward_type setting and/or available blocks
|
||||||
|
if ($config['reward_type'] != 'block') {
|
||||||
|
$aGlobal['ppsvalue'] = number_format(round(50 / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
||||||
|
} else {
|
||||||
|
// Try to find the last block value and use that for future payouts, revert to fixed reward if none found
|
||||||
|
if ($aLastBlock = $block->getLast()) {
|
||||||
|
$aGlobal['ppsvalue'] = number_format(round($aLastBlock['amount'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
||||||
|
} else {
|
||||||
|
$aGlobal['ppsvalue'] = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We don't want these session infos cached
|
// We don't want these session infos cached
|
||||||
if (@$_SESSION['USERDATA']['id']) {
|
if (@$_SESSION['USERDATA']['id']) {
|
||||||
$aGlobal['userdata'] = $_SESSION['USERDATA']['id'] ? $user->getUserData($_SESSION['USERDATA']['id']) : array();
|
$aGlobal['userdata'] = $_SESSION['USERDATA']['id'] ? $user->getUserData($_SESSION['USERDATA']['id']) : array();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user