From 9e4d95a7e26837acc5f9529ecf00908aca510fc3 Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 16 Dec 2015 12:12:53 +1100 Subject: [PATCH 1/9] php - add more explanation to the payout details --- pool/base.php | 31 ++++++++++++++++++++++++++++--- pool/page_payout.php | 24 +++++++++++++++++++++--- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/pool/base.php b/pool/base.php index 583ebcf6..4acf3de0 100644 --- a/pool/base.php +++ b/pool/base.php @@ -99,7 +99,7 @@ function howlongago($sec) return $des; } # -function howmanyhrs($tot, $days = false) +function howmanyhrs($tot, $days = false, $dh = false) { $sec = round($tot); if ($sec < 60) @@ -118,10 +118,35 @@ function howmanyhrs($tot, $days = false) { $dy = floor($hr / 24); $hr -= $dy * 24; - $des = $dy.'d '.$hr.'hr '.$min.'m '.$sec.'s'; + if ($dh == true) + { + if ($min >= 30) + $hr++; + $ds = ''; + if ($dy != 1) + $ds = 's'; + $hs = ''; + if ($hr != 1) + $hs = 's'; + $des = "${dy}day$ds ${hr}hr$hs"; + } + else + $des = $dy.'d '.$hr.'hr '.$min.'m '.$sec.'s'; } else - $des = $hr.'hr '.$min.'m '.$sec.'s'; + { + if ($dh == true) + { + if ($min >= 30) + $hr++; + $hs = ''; + if ($hr != 1) + $hs = 's'; + $des = "${hr}hr$hs"; + } + else + $des = $hr.'hr '.$min.'m '.$sec.'s'; + } } } return $des; diff --git a/pool/page_payout.php b/pool/page_payout.php index b6574cea..a99f09fd 100644 --- a/pool/page_payout.php +++ b/pool/page_payout.php @@ -14,7 +14,16 @@ function dopayout($data, $user) if (isset($data['info']['currndiff'])) $nd = $data['info']['currndiff']; $nv = number_format($nd, 1); - $nvx = number_format($N*$nd, 1); + $nvx = ''.number_format($N*$nd, 1).''; + $phr = $data['info']['p_hashrate24hr']; + $hr = 'is ?'; + $hrt = '?'; + if ($phr != '?' && $phr != '' && $phr > 0) + { + $hr = 'for the last day is '.dsprate($phr).''; + if ($nd > 0) + $hrt = ''.howmanyhrs($nd / ($phr / pow(2,32)), true, true).''; + } $pg = "

Payouts

@@ -28,7 +37,16 @@ The $n1 value the pool uses is $t times the network difficulty when the block is Transaction fees are included in the miner reward.
Pool fee is 0.9% of the total.

-How do the payments work?

+PPL${n1}S acts like the reward 'ramps up' when you first start mining.
What actually happens?


+The $n means it takes that long to reward your shares.
+The ramp isn't missing rewards, it's delaying them to reduce variance.
+Each share is rewarded in all the blocks found in the $n after the share.
+That's simply how it reduces variance. Each share's reward is averaged out over the $n after it.
+The pool hash rate $hr which means the $n 'ramp' is roughly $hrt.

+ +Continue reading below for more detail about how it works:

+ +How do the PPL${n1}S payments work?

The $n means the pool rewards $t times the expected number of shares, each time a block is found.
So each share will be paid approximately $ot of it's expected value, in each block it gets a reward,
but each share is also expected, on average, to be rewarded $t times in blocks found after the share is submitted to the pool.
@@ -48,7 +66,7 @@ A ckpool restart will also end the current shift and start a new shift.
A network difficulty change will also end the current shift and start a new shift.

So, what's the $n value?

-The current Bitcoin network value for $n1d is $nv and thus $n is $nvx
+The current Bitcoin network value for $n1d is $nv and thus $n is $nvx
Bitcoin adjusts the $n1d value every 2016 blocks, which is about every 2 weeks.

When a block is found, the reward process counts back shifts until the total share difficulty included is $n.
Since shares are summarised into shifts, it will include the full shift at the end of the range counting backwards,
From 3ae73463fe27753eb2c6d0c2d1f22959abf70aac Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 16 Dec 2015 12:25:39 +1100 Subject: [PATCH 2/9] php - payout help number formatting --- pool/base.php | 20 ++++++++++++++++---- pool/page_payout.php | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pool/base.php b/pool/base.php index 4acf3de0..35523c92 100644 --- a/pool/base.php +++ b/pool/base.php @@ -121,14 +121,26 @@ function howmanyhrs($tot, $days = false, $dh = false) if ($dh == true) { if ($min >= 30) + { $hr++; + if ($hr == 24) + { + $days++; + $hr = 0; + } + } $ds = ''; if ($dy != 1) $ds = 's'; - $hs = ''; - if ($hr != 1) - $hs = 's'; - $des = "${dy}day$ds ${hr}hr$hs"; + if ($hr == 0) + $des = "${dy}day$ds"; + else + { + $hs = ''; + if ($hr != 1) + $hs = 's'; + $des = "${dy}day$ds ${hr}hr$hs"; + } } else $des = $dy.'d '.$hr.'hr '.$min.'m '.$sec.'s'; diff --git a/pool/page_payout.php b/pool/page_payout.php index a99f09fd..5990b6fd 100644 --- a/pool/page_payout.php +++ b/pool/page_payout.php @@ -15,14 +15,14 @@ function dopayout($data, $user) $nd = $data['info']['currndiff']; $nv = number_format($nd, 1); $nvx = ''.number_format($N*$nd, 1).''; - $phr = $data['info']['p_hashrate24hr']; + $pd = $data['info']['p_hashrate24hr']; $hr = 'is ?'; $hrt = '?'; - if ($phr != '?' && $phr != '' && $phr > 0) + if ($pd != '?' && $pd != '' && $pd > 0) { - $hr = 'for the last day is '.dsprate($phr).''; + $hr = 'for the last day is roughly '.siprefmt($pd,2).'Hs'; if ($nd > 0) - $hrt = ''.howmanyhrs($nd / ($phr / pow(2,32)), true, true).''; + $hrt = ''.howmanyhrs($nd * $N / ($pd / pow(2,32)), true, true).''; } $pg = "

Payouts

From 92f7d8ce388aa3f7093e7465a81aa9cc2e821732 Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 16 Dec 2015 19:52:05 +1100 Subject: [PATCH 3/9] php - correct hour overflow calculation in howmanyhrs --- pool/base.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pool/base.php b/pool/base.php index 35523c92..4430a175 100644 --- a/pool/base.php +++ b/pool/base.php @@ -123,10 +123,10 @@ function howmanyhrs($tot, $days = false, $dh = false) if ($min >= 30) { $hr++; - if ($hr == 24) + if ($hr > 23) { - $days++; - $hr = 0; + $dy++; + $hr -= 24; } } $ds = ''; From 11537481fd174f5e5294da2d51e2cba9fbfdbd8d Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 16 Dec 2015 23:50:52 +1100 Subject: [PATCH 4/9] Fail gracefully after 5 unsuccessful attempts to update_base --- src/stratifier.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index 37a0cda7..fef6eb13 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -932,6 +932,8 @@ retry: LOGWARNING("Generator returned failure in update_base, retry #%d", retries); goto retry; } + LOGWARNING("Generator failed in update_base after retrying"); + goto out; } if (unlikely(retries)) LOGWARNING("Generator succeeded in update_base after retrying"); From a15279105ff6000fd704243c835ab1a690ee1487 Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 17 Dec 2015 14:41:19 +1100 Subject: [PATCH 5/9] php - label the shift graph 5Nd reward --- pool/page_usperf.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pool/page_usperf.php b/pool/page_usperf.php index 18961794..d99591b0 100644 --- a/pool/page_usperf.php +++ b/pool/page_usperf.php @@ -1,8 +1,8 @@ =0&&fi>=0){var xs,xf;xs=(st-x0)/(x1-x0);xf=(fi-x0)/(x1-x0);gfs(c,'$fs');gbe(c,xs,0);gln(c,xs,1);gln(c,xf,1);gln(c,xf,0);gle(c);gfl(c)}}} +$g = "function exf(n,c,xn,x0,x1,y0,y1,ar){if(n==0){var i,st=-1,fi=-1;for(i=0;i=0&&fi>=0){var xs,xf;xs=(st-x0)/(x1-x0);xf=(fi-x0)/(x1-x0);gfs(c,'$fs');gbe(c,xs,0);gln(c,xs,1);gln(c,xf,1);gln(c,xf,0);gle(c);gfl(c);gfz(c,xs,1,0,2,'Last 5Nd Reward \u279c','$ff','left')}}} function gdrw(c,d,cbx){gc(c);ghrs(c);gopt(c,cbx); gfs(c,'white');gss(c,'#0000c0');glw(c,2);gbd(c); var rows=d['rows'],ymin=-1,ymax=0,xmin=-1,xmax=0,tda=[]; @@ -110,7 +110,7 @@ function dousperf($data, $user) $data = str_replace(array("\\","'"), array("\\\\","\\'"), $ans['DATA']); $data .= $fld_sep . 'cols' . $val_sep . $datacols; $pg .= "