Adding support to pay out full block amount
* Configuration setting added: `reward_type` * Default behaviour: `fixed` payout by `reward` setting * Optional: `block` to payout full block amount to users Fixes #76
This commit is contained in:
parent
15adb94d9c
commit
2204b6d9f3
@ -72,7 +72,7 @@ if (empty($aAllBlocks)) {
|
|||||||
verbose("No new unaccounted blocks found\n");
|
verbose("No new unaccounted blocks found\n");
|
||||||
} else {
|
} else {
|
||||||
// Loop through our unaccounted blocks
|
// Loop through our unaccounted blocks
|
||||||
verbose("\nBlock ID\tBlock Height\tShare ID\tShares\tFinder\t\t\tStatus\n");
|
verbose("\nBlock ID\tBlock Height\tAmount\tShare ID\tShares\tFinder\t\t\tStatus\n");
|
||||||
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||||
if (empty($aBlock['share_id'])) {
|
if (empty($aBlock['share_id'])) {
|
||||||
// Fetch this blocks upstream ID
|
// Fetch this blocks upstream ID
|
||||||
@ -107,6 +107,7 @@ if (empty($aAllBlocks)) {
|
|||||||
verbose(
|
verbose(
|
||||||
$aBlock['id'] . "\t\t"
|
$aBlock['id'] . "\t\t"
|
||||||
. $aBlock['height'] . "\t\t"
|
. $aBlock['height'] . "\t\t"
|
||||||
|
. $aBlock['amount'] . "\t"
|
||||||
. $iCurrentUpstreamId . "\t\t"
|
. $iCurrentUpstreamId . "\t\t"
|
||||||
. $iRoundShares . "\t"
|
. $iRoundShares . "\t"
|
||||||
. "[$iAccountId] " . $user->getUserName($iAccountId) . "\t\t"
|
. "[$iAccountId] " . $user->getUserName($iAccountId) . "\t\t"
|
||||||
|
|||||||
@ -42,6 +42,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
$iCurrentUpstreamId = $aBlock['share_id'];
|
$iCurrentUpstreamId = $aBlock['share_id'];
|
||||||
$aAccountShares = $share->getSharesForAccounts($iPreviousShareId, $aBlock['share_id']);
|
$aAccountShares = $share->getSharesForAccounts($iPreviousShareId, $aBlock['share_id']);
|
||||||
$iRoundShares = $share->getRoundShares($iPreviousShareId, $aBlock['share_id']);
|
$iRoundShares = $share->getRoundShares($iPreviousShareId, $aBlock['share_id']);
|
||||||
|
$config['reward_type'] == 'block' ? $dReward = $aBlock['amount'] : $dReward = $config['reward'];
|
||||||
|
|
||||||
if (empty($aAccountShares)) {
|
if (empty($aAccountShares)) {
|
||||||
verbose("\nNo shares found for this block\n\n");
|
verbose("\nNo shares found for this block\n\n");
|
||||||
@ -56,7 +57,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
foreach ($aAccountShares as $key => $aData) {
|
foreach ($aAccountShares as $key => $aData) {
|
||||||
// Payout based on shares, PPS system
|
// Payout based on shares, PPS system
|
||||||
$aData['percentage'] = number_format(round(( 100 / $iRoundShares ) * $aData['valid'], 8), 8);
|
$aData['percentage'] = number_format(round(( 100 / $iRoundShares ) * $aData['valid'], 8), 8);
|
||||||
$aData['payout'] = number_format(round(( $aData['percentage'] / 100 ) * $config['reward'], 8), 8);
|
$aData['payout'] = number_format(round(( $aData['percentage'] / 100 ) * $dReward, 8), 8);
|
||||||
// Defaults
|
// Defaults
|
||||||
$aData['fee' ] = 0;
|
$aData['fee' ] = 0;
|
||||||
$aData['donation'] = 0;
|
$aData['donation'] = 0;
|
||||||
|
|||||||
@ -60,6 +60,7 @@ $config = array(
|
|||||||
'fees' => 0,
|
'fees' => 0,
|
||||||
'difficulty' => '20', // Target difficulty for this pool as set in pushpoold json
|
'difficulty' => '20', // Target difficulty for this pool as set in pushpoold json
|
||||||
'reward' => '50', // Reward for finding blocks, fixed value but changes someday
|
'reward' => '50', // Reward for finding blocks, fixed value but changes someday
|
||||||
|
'reward_type' => 'fixed', // Payout `fixed` reward as defined in reward or `block` amount
|
||||||
'confirmations' => '120', // Confirmations per block needed to credit transactions
|
'confirmations' => '120', // Confirmations per block needed to credit transactions
|
||||||
'memcache' => array(
|
'memcache' => array(
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user