Attribute whatever stats we can get on untracked stratum shares based on current pool diff.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/cgminer.c b/cgminer.c
index a3cd733..3b7a387 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);