Browse Source

Allow more rapid adjustment of diff down by restarting calculation with each diff change and not capping diff drop

master
Con Kolivas 10 years ago
parent
commit
f484ffd45b
  1. 8
      src/stratifier.c

8
src/stratifier.c

@ -1526,7 +1526,7 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool
ck_runlock(&workbase_lock); ck_runlock(&workbase_lock);
tdiff = sane_tdiff(&now_t, &client->last_share); tdiff = sane_tdiff(&now_t, &client->last_share);
if (unlikely(!client->first_share.tv_sec)) { if (!client->first_share.tv_sec) {
copy_tv(&client->first_share, &now_t); copy_tv(&client->first_share, &now_t);
copy_tv(&client->ldc, &now_t); copy_tv(&client->ldc, &now_t);
} }
@ -1562,6 +1562,7 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool
if (diff != client->diff) { if (diff != client->diff) {
client->ssdc = 0; client->ssdc = 0;
client->first_share.tv_sec = 0;
return; return;
} }
@ -1574,10 +1575,6 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool
return; return;
optimal = round(dsps * 3.33); optimal = round(dsps * 3.33);
/* Don't drop diff to rapidly in case the client simply switched away
* and has just returned */
if (optimal < client->diff / 2)
optimal = client->diff / 2;
/* Clamp to mindiff ~ network_diff */ /* Clamp to mindiff ~ network_diff */
if (optimal < ckp->mindiff) if (optimal < ckp->mindiff)
optimal = ckp->mindiff; optimal = ckp->mindiff;
@ -1586,6 +1583,7 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool
if (client->diff == optimal) if (client->diff == optimal)
return; return;
client->first_share.tv_sec = 0;
client->ssdc = 0; client->ssdc = 0;
LOGINFO("Client %d biased dsps %.2f dsps %.2f drr %.2f adjust diff from %ld to: %ld ", LOGINFO("Client %d biased dsps %.2f dsps %.2f drr %.2f adjust diff from %ld to: %ld ",

Loading…
Cancel
Save