Commit 1d7e19f2f2489366630e246edbb70c4cc939af04

Con Kolivas 2012-11-11T16:10:45

Check for both coinbase/append and submit/coinbase support before using GBT protocol.

diff --git a/cgminer.c b/cgminer.c
index 7971867..62f650c 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4772,6 +4772,7 @@ retry_stratum:
 		val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass,
 				    gbt_req, true, false, &rolltime, pool, false);
 		if (val) {
+			bool append = false, submit = false;
 			json_t *res_val, *mutables;
 			int i, mutsize = 0;
 
@@ -4787,24 +4788,29 @@ retry_stratum:
 				if (json_is_string(arrval)) {
 					const char *mutable = json_string_value(arrval);
 
-					/* Only use GBT if it supports coinbase append */
-					if (!strncasecmp(mutable, "coinbase/append", 15)) {
-						pool->has_gbt = true;
-						pool->rpc_req = gbt_req;
-						break;
-					}
+					if (!strncasecmp(mutable, "coinbase/append", 15))
+						append = true;
+					else if (!strncasecmp(mutable, "submit/coinbase", 15))
+						submit = true;
 				}
 			}
 			json_decref(val);
+
+			/* Only use GBT if it supports coinbase append and
+			 * submit coinbase */
+			if (append && submit) {
+				pool->has_gbt = true;
+				pool->rpc_req = gbt_req;
+			}
 		}
 		/* Reset this so we can probe fully just after this. It will be
 		 * set to true that time.*/
 		pool->probed = false;
 
 		if (pool->has_gbt)
-			applog(LOG_DEBUG, "GBT coinbase append support found, switching to GBT protocol");
+			applog(LOG_DEBUG, "GBT coinbase + append support found, switching to GBT protocol");
 		else
-			applog(LOG_DEBUG, "No GBT coinbase append support found, using getwork protocol");
+			applog(LOG_DEBUG, "No GBT coinbase + append support found, using getwork protocol");
 	}
 
 	gettimeofday(&tv_getwork, NULL);