Browse Source

Merge commit '61696c0' into bfgminer

Luke Dashjr 13 years ago
parent
commit
836f8d55f8
3 changed files with 17 additions and 12 deletions
  1. 6 6
      api.c
  2. 10 6
      miner.c
  3. 1 0
      miner.h

+ 6 - 6
api.c

@@ -1445,7 +1445,7 @@ static void switchpool(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
 	}
 
 	pool = pools[id];
-	pool->enabled = true;
+	pool->enabled = POOL_ENABLED;
 	switch_pools(pool);
 
 	strcpy(io_buffer, message(MSG_SWITCHP, id, NULL, isjson));
@@ -1557,12 +1557,12 @@ static void enablepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
 	}
 
 	pool = pools[id];
-	if (pool->enabled == true) {
+	if (pool->enabled == POOL_ENABLED) {
 		strcpy(io_buffer, message(MSG_ALRENAP, id, NULL, isjson));
 		return;
 	}
 
-	pool->enabled = true;
+	pool->enabled = POOL_ENABLED;
 	if (pool->prio < current_pool()->prio)
 		switch_pools(pool);
 
@@ -1591,7 +1591,7 @@ static void disablepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
 	}
 
 	pool = pools[id];
-	if (pool->enabled == false) {
+	if (pool->enabled == POOL_DISABLED) {
 		strcpy(io_buffer, message(MSG_ALRDISP, id, NULL, isjson));
 		return;
 	}
@@ -1601,7 +1601,7 @@ static void disablepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
 		return;
 	}
 
-	pool->enabled = false;
+	pool->enabled = POOL_DISABLED;
 	if (pool == current_pool())
 		switch_pools(NULL);
 
@@ -1645,7 +1645,7 @@ static void removepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
 		return;
 	}
 
-	pool->enabled = false;
+	pool->enabled = POOL_DISABLED;
 	rpc_url = escape_string(pool->rpc_url, isjson);
 	if (rpc_url != pool->rpc_url)
 		dofree = true;

+ 10 - 6
miner.c

@@ -1655,8 +1655,10 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
 #ifndef MIPSEB
 // This one segfaults on my router for some reason
 		isblock = regeneratehash(work);
-		if (isblock)
+		if (unlikely(isblock)) {
+			pool->solved++;
 			found_blocks++;
+		}
 		hash32 = (uint32_t *)(work->hash);
 		sprintf(hashshow, "%08lx.%08lx%s", (unsigned long)(hash32[6]), (unsigned long)(hash32[5]),
 			isblock ? " BLOCK!" : "");
@@ -2593,7 +2595,9 @@ static void display_pool_summary(struct pool *pool)
 
 	if (curses_active_locked()) {
 		wlog("Pool: %s\n", pool->rpc_url);
-		wlog("%s long-poll support\n", pool->hdr_path ? "Has" : "Does not have");
+		if (pool->solved)
+			wlog("SOLVED %d BLOCK%s!\n", pool->solved, pool->solved > 1 ? "S" : "");
+		wlog("%s own long-poll support\n", pool->hdr_path ? "Has" : "Does not have");
 		wlog(" Queued work requests: %d\n", pool->getwork_requested);
 		wlog(" Share submissions: %d\n", pool->accepted + pool->rejected);
 		wlog(" Accepted shares: %d\n", pool->accepted);
@@ -4427,6 +4431,8 @@ static void print_summary(void)
 			struct pool *pool = pools[i];
 
 			applog(LOG_WARNING, "Pool: %s", pool->rpc_url);
+			if (pool->solved)
+				applog(LOG_WARNING, "SOLVED %d BLOCK%s!", pool->solved, pool->solved > 1 ? "S" : "");
 			applog(LOG_WARNING, " Queued work requests: %d", pool->getwork_requested);
 			applog(LOG_WARNING, " Share submissions: %d", pool->accepted + pool->rejected);
 			applog(LOG_WARNING, " Accepted shares: %d", pool->accepted);
@@ -4444,10 +4450,8 @@ static void print_summary(void)
 	}
 
 	applog(LOG_WARNING, "Summary of per device statistics:\n");
-	for (i = 0; i < total_devices; ++i) {
-		if (devices[i]->deven == DEV_ENABLED)
-			log_print_status(devices[i]);
-	}
+	for (i = 0; i < total_devices; ++i)
+		log_print_status(devices[i]);
 
 	if (opt_shares)
 		applog(LOG_WARNING, "Mined %d accepted shares of %d requested\n", total_accepted, opt_shares);

+ 1 - 0
miner.h

@@ -627,6 +627,7 @@ struct pool {
 	int prio;
 	int accepted, rejected;
 	int seq_rejects;
+	int solved;
 
 	bool submit_fail;
 	bool idle;