Browse Source

Add pool_has_usable_swork function

Luke Dashjr 12 years ago
parent
commit
a86bdface0
3 changed files with 9 additions and 3 deletions
  1. 3 3
      driver-stratum.c
  2. 5 0
      miner.c
  3. 1 0
      miner.h

+ 3 - 3
driver-stratum.c

@@ -275,11 +275,11 @@ void _stratumsrv_update_notify(evutil_socket_t fd, short what, __maybe_unused vo
 	else
 		stratumsrv_job_pruner();
 	
-	if (!pool->stratum_notify)
+	if (!pool_has_usable_swork(pool))
 	{
-		applog(LOG_WARNING, "SSM: Not using a stratum server upstream!");
+		applog(LOG_WARNING, "SSM: No usable 2D work upstream!");
 		if (clean)
-			stratumsrv_boot_all_subscribed("Current upstream pool does not have active stratum");
+			stratumsrv_boot_all_subscribed("Current upstream pool does not have usable 2D work");
 		goto out;
 	}
 	

+ 5 - 0
miner.c

@@ -8643,6 +8643,11 @@ void stratum_work_clean(struct stratum_work * const swork)
 	bytes_free(&swork->merkle_bin);
 }
 
+bool pool_has_usable_swork(const struct pool * const pool)
+{
+	return pool->stratum_notify;
+}
+
 /* Generates stratum based work based on the most recent notify information
  * from the pool. This will keep generating work while a pool is down so we use
  * other means to detect when the pool has died in stratum_thread */

+ 1 - 0
miner.h

@@ -1344,6 +1344,7 @@ extern void get_datestamp(char *, size_t, time_t);
 #define get_now_datestamp(buf, bufsz)  get_datestamp(buf, bufsz, INVALID_TIMESTAMP)
 extern void stratum_work_cpy(struct stratum_work *dst, const struct stratum_work *src);
 extern void stratum_work_clean(struct stratum_work *);
+extern bool pool_has_usable_swork(const struct pool *);
 extern void gen_stratum_work2(struct work *, struct stratum_work *, const char *nonce1);
 extern void inc_hw_errors3(struct thr_info *thr, const struct work *work, const uint32_t *bad_nonce_p, float nonce_diff);
 static inline