ckdb/php - move to PPLNS 5xN but handle the workmarkers restriction
This commit is contained in:
parent
eaa583661c
commit
e4c714ca94
@ -6,11 +6,11 @@ function dopayout($data, $user)
|
||||
$pg .= '<table width=75% cellpadding=0 cellspacing=0 border=0>';
|
||||
$pg .= '<tr><td class=dc>';
|
||||
$pg .= 'We use PPLNS (pay per last N shares)<br><br>';
|
||||
$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,<br>';
|
||||
$pg .= 'but includes the full shift at the start and end of the range,<br>';
|
||||
$pg .= 'so it usually will be a bit more than N.<br><br>';
|
||||
$pg .= 'Shifts are ~30s long, however, when a block is found<br>';
|
||||
$pg .= 'so it usually will be a bit more than 5N.<br><br>';
|
||||
$pg .= 'Shifts are ~30s long, however, when any network block is found<br>';
|
||||
$pg .= 'the current shift ends at the point the block was found.<br>';
|
||||
$pg .= 'A ckpool restart will also start a new shift.<br><br>';
|
||||
$pg .= 'Transaction fees are included in the miner payout.<br>';
|
||||
|
||||
@ -144,6 +144,8 @@ Block: <input type=text name=blk size=10 value='$blkuse'>
|
||||
$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)
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user