diff --git a/pool/page_payout.php b/pool/page_payout.php index e45e70ca..5949edf3 100644 --- a/pool/page_payout.php +++ b/pool/page_payout.php @@ -6,11 +6,11 @@ function dopayout($data, $user) $pg .= '
';
$pg .= 'We use PPLNS (pay per last N shares) '; - $pg .= 'The N value used for PPLNS is the network difficulty'; + $pg .= 'The N value used for PPLNS is 5 times the network difficulty'; $pg .= ' when a block is found, '; $pg .= 'but includes the full shift at the start and end of the range, '; - $pg .= 'so it usually will be a bit more than N. '; - $pg .= 'Shifts are ~30s long, however, when a block is found '; + $pg .= 'so it usually will be a bit more than 5N. '; + $pg .= 'Shifts are ~30s long, however, when any network block is found '; $pg .= 'the current shift ends at the point the block was found. '; $pg .= 'A ckpool restart will also start a new shift. '; $pg .= 'Transaction fees are included in the miner payout. '; diff --git a/pool/page_pplns.php b/pool/page_pplns.php index 50eb8b4b..dccd04f6 100644 --- a/pool/page_pplns.php +++ b/pool/page_pplns.php @@ -144,6 +144,8 @@ Block: $dotx = true; $flds = array('height' => $blk, 'allow_aged' => 'Y'); + if ($blk > 334106) + $flds['diff_times'] = '5'; $msg = msgEncode('pplns', 'pplns', $flds, $user); $rep = sendsockreply('pplns', $msg); if ($rep == false) diff --git a/src/ckdb.h b/src/ckdb.h index bb04ac3a..07584c2a 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "0.9.6" -#define CKDB_VERSION DB_VERSION"-0.752" +#define CKDB_VERSION DB_VERSION"-0.760" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index ae524de8..9f3ae8bb 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -3163,6 +3163,16 @@ static K_TREE *upd_add_mu(K_TREE *mu_root, K_STORE *mu_store, int64_t userid, in data going back in time to 'begin' */ +/* Blocks after 334106 were set to 5xN + * however, they cannot count back to include the workinfoid of 333809 + * due to the markersummaries that were created. + * Code checks that if the block is after FIVExSTT then it must stop + * counting back shares at - and not include - FIVExWID */ +#define FIVExSTT 334106 +#define FIVExLIM 333809 +// 333809 workinfoid +#define FIVExWID 6085620100361146842 + static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id, __maybe_unused tv_t *now, __maybe_unused char *by, __maybe_unused char *code, __maybe_unused char *inet, @@ -3196,7 +3206,7 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id, double diff_times = 1.0; double diff_add = 0.0; double diff_want; - bool allow_aged = false; + bool allow_aged = false, countbacklimit; char ndiffbin[TXT_SML+1]; size_t len, off; int rows; @@ -3288,6 +3298,11 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id, return strdup(reply); } + if (blocks->height > FIVExSTT) + countbacklimit = true; + else + countbacklimit = false; + begin_workinfoid = end_workinfoid = 0; total_share_count = acc_share_count = 0; total_diff = 0; @@ -3322,6 +3337,11 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id, default: share_status = "Not ready1"; } + + // Stop before FIVExWID if necessary + if (countbacklimit && sharesummary->workinfoid <= FIVExWID) + break; + ss_count++; total_share_count += sharesummary->sharecount; acc_share_count += sharesummary->shareacc; @@ -3377,6 +3397,10 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id, DATA_WORKMARKERS_NULL(workmarkers, wm_item); while (total_diff < diff_want && wm_item && CURRENT(&(workmarkers->expirydate))) { if (WMPROCESSED(workmarkers->status)) { + // Stop before FIVExWID if necessary + if (countbacklimit && workmarkers->workinfoidstart <= FIVExWID) + break; + wm_count++; lookmarkersummary.markerid = workmarkers->markerid; lookmarkersummary.userid = MAXID; |