Merge pull request #1974 from MPOS/coin-pps-value

[ADDED] Calc Coin PPS Value Method
This commit is contained in:
Sebastian Grewe 2014-03-20 12:12:47 +01:00
commit 2c3ae28fca
3 changed files with 10 additions and 2 deletions

View File

@ -63,7 +63,7 @@ if ($config['pps']['reward']['type'] == 'blockavg' && $block->getBlockCount() >
}
// Per-share value to be paid out to users
$pps_value = round($pps_reward / (pow(2, $coin->getTargetBits()) * $dDifficulty), 12);
$pps_value = round($coin->calcPPSValue($pps_reward, $dDifficulty), 12);
// Find our last share accounted and last inserted share for PPS calculations
if (!$iPreviousShareId = $setting->getValue('pps_last_share_id')) {

View File

@ -19,6 +19,14 @@ class CoinBase extends Base {
return $this->target_bits;
}
/**
* Calculate the PPS value for this coin
* WARNING: Get this wrong and you will over- or underpay your miners!
**/
public function calcPPSValue($pps_reward, $dDifficulty) {
return ($pps_reward / (pow(2, $this->target_bits) * $dDifficulty));
}
/**
* Calculate our hashrate based on shares inserted to DB
* We use diff1 share values, not a baseline one

View File

@ -892,7 +892,7 @@ class Statistics extends Base {
$pps_reward = $this->config['pps']['reward']['default'];
}
}
return round($pps_reward / (pow(2, $this->coin->getTargetBits()) * $dDifficulty), 12);
return round($this->coin->calcPPSValue($pps_reward, $dDifficulty), 12);
}
/**