From 4efe9ca82e13ebb594e382be8c70dbc2f01321ce Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 13 May 2013 22:23:13 +1000 Subject: [PATCH] Attribute whatever stats we can get on untracked stratum shares based on current pool diff. --- cgminer.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/cgminer.c b/cgminer.c index a3cd7339..3b7a387e 100644 --- a/cgminer.c +++ b/cgminer.c @@ -4757,10 +4757,35 @@ static bool parse_stratum_response(struct pool *pool, char *s) mutex_unlock(&sshare_lock); if (!sshare) { - if (json_is_true(res_val)) + double pool_diff; + + /* Since the share is untracked, we can only guess at what the + * work difficulty is based on the current pool diff. */ + cg_rlock(&pool->data_lock); + pool_diff = pool->swork.diff; + cg_runlock(&pool->data_lock); + + if (json_is_true(res_val)) { applog(LOG_NOTICE, "Accepted untracked stratum share from pool %d", pool->pool_no); - else + + /* We don't know what device this came from so we can't + * attribute the work to the relevant cgpu */ + mutex_lock(&stats_lock); + total_accepted++; + pool->accepted++; + total_diff_accepted += pool_diff; + pool->diff_accepted += pool_diff; + mutex_unlock(&stats_lock); + } else { applog(LOG_NOTICE, "Rejected untracked stratum share from pool %d", pool->pool_no); + + mutex_lock(&stats_lock); + total_rejected++; + pool->rejected++; + total_diff_rejected += pool_diff; + pool->diff_rejected += pool_diff; + mutex_unlock(&stats_lock); + } goto out; } stratum_share_result(val, res_val, err_val, sshare);