From e684a987cc430164c289b151144be09c5d75d352 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 20 Mar 2014 12:11:35 +0100 Subject: [PATCH] [ADDED] Calc Coin PPS Value Method --- cronjobs/pps_payout.php | 2 +- public/include/classes/coins/coin_base.class.php | 8 ++++++++ public/include/classes/statistics.class.php | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cronjobs/pps_payout.php b/cronjobs/pps_payout.php index d7036ee0..cc1cbad1 100755 --- a/cronjobs/pps_payout.php +++ b/cronjobs/pps_payout.php @@ -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')) { diff --git a/public/include/classes/coins/coin_base.class.php b/public/include/classes/coins/coin_base.class.php index 79e74c58..64e412e2 100644 --- a/public/include/classes/coins/coin_base.class.php +++ b/public/include/classes/coins/coin_base.class.php @@ -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 diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index b04bff4a..d368afe4 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -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); } /**