Browse Source

Bugfix: Correctly track discarded stratum shares, and log them as "disconnect" in sharelog

Luke Dashjr 13 years ago
parent
commit
cc0bbf0095
1 changed files with 11 additions and 2 deletions
  1. 11 2
      miner.c

+ 11 - 2
miner.c

@@ -5405,12 +5405,19 @@ static bool pool_active(struct pool *pool, bool pinging);
 static void clear_stratum_shares(struct pool *pool)
 {
 	struct stratum_share *sshare, *tmpshare;
+	struct work *work;
 	int cleared = 0;
+	double diff_stale = 0;
 
 	mutex_lock(&sshare_lock);
 	HASH_ITER(hh, stratum_shares, sshare, tmpshare) {
 		if (sshare->work.pool == pool) {
 			HASH_DEL(stratum_shares, sshare);
+			
+			work = &sshare->work;
+			sharelog("disconnect", work);
+			diff_stale += work->work_difficulty;
+			
 			clear_work(&sshare->work);
 			free(sshare);
 			cleared++;
@@ -5420,8 +5427,10 @@ static void clear_stratum_shares(struct pool *pool)
 
 	if (cleared) {
 		applog(LOG_WARNING, "Lost %d shares due to stratum disconnect on pool %d", cleared, pool->pool_no);
-		pool->stale_shares++;
-		total_stale++;
+		pool->stale_shares += cleared;
+		total_stale += cleared;
+		total_diff_stale += diff_stale;
+		pool->diff_stale += diff_stale;
 	}
 }