Browse Source

Update diff stale: total and pools when stratum throws away shares

Kano 13 years ago
parent
commit
42a01e7b37
1 changed files with 4 additions and 0 deletions
  1. 4 0
      cgminer.c

+ 4 - 0
cgminer.c

@@ -4698,12 +4698,14 @@ out:
 void clear_stratum_shares(struct pool *pool)
 {
 	struct stratum_share *sshare, *tmpshare;
+	double diff_cleared = 0;
 	int cleared = 0;
 
 	mutex_lock(&sshare_lock);
 	HASH_ITER(hh, stratum_shares, sshare, tmpshare) {
 		if (sshare->work->pool == pool) {
 			HASH_DEL(stratum_shares, sshare);
+			diff_cleared += sshare->work->work_difficulty;
 			free_work(sshare->work);
 			free(sshare);
 			cleared++;
@@ -4715,6 +4717,8 @@ void clear_stratum_shares(struct pool *pool)
 		applog(LOG_WARNING, "Lost %d shares due to stratum disconnect on pool %d", cleared, pool->pool_no);
 		pool->stale_shares += cleared;
 		total_stale += cleared;
+		pool->diff_stale += diff_cleared;
+		total_diff_stale += diff_cleared;
 	}
 }