Browse Source

Bugfix: Immediately discard shares found on disconnected stratum pools, since there is no way to submit them

Luke Dashjr 13 years ago
parent
commit
02d4a94465
1 changed files with 15 additions and 2 deletions
  1. 15 2
      miner.c

+ 15 - 2
miner.c

@@ -457,6 +457,7 @@ struct pool *add_pool(void)
 
 	pool->rpc_proxy = NULL;
 
+	pool->sock = INVSOCK;
 	pool->lp_socket = CURL_SOCKET_BAD;
 
 	pools = realloc(pools, sizeof(struct pool *) * (total_pools + 2));
@@ -3594,15 +3595,20 @@ static void check_solve(struct work *work)
 	}
 }
 
-static void submit_discard_share(struct work *work)
+static void submit_discard_share2(const char *reason, struct work *work)
 {
-	sharelog("discard", work);
+	sharelog(reason, work);
 	++total_stale;
 	++(work->pool->stale_shares);
 	total_diff_stale += work->work_difficulty;
 	work->pool->diff_stale += work->work_difficulty;
 }
 
+static void submit_discard_share(struct work *work)
+{
+	submit_discard_share2("discard", work);
+}
+
 static void *submit_work_thread(void *userdata)
 {
 	struct workio_cmd *wc = (struct workio_cmd *)userdata;
@@ -3624,6 +3630,12 @@ next_submit:
 	resubmit = false;
 	failures = 0;
 
+	if (work->stratum && pool->sock == INVSOCK) {
+		applog(LOG_WARNING, "Share found for dead stratum pool %u, discarding", pool->pool_no);
+		submit_discard_share2("disconnect", work);
+		goto out;
+	}
+
 	check_solve(work);
 
 	if (stale_work(work, true)) {
@@ -5478,6 +5490,7 @@ static void *stratum_thread(void *userdata)
 			total_go++;
 
 			// Make any pending work/shares stale
+			pool->sock = INVSOCK;
 			pool->submit_old = false;
 			++pool->work_restart_id;