Commit e9e86fe754e85d2fd28f07399d1a517cbf816d1b

Con Kolivas 2014-05-25T09:51:25

Add support for 2 nonces per block in spond driver

diff --git a/driver-spondoolies.c b/driver-spondoolies.c
index d5b0893..69be6b2 100644
--- a/driver-spondoolies.c
+++ b/driver-spondoolies.c
@@ -363,7 +363,7 @@ static int64_t spond_scanhash(struct thr_info *thr)
 	}
 
 	if (a->parse_resp) {
-		int array_size, i;
+		int array_size, i, j;
 
 		mutex_lock(&a->lock);
 		ghashes = (a->mp_last_rsp->gh_div_10_rate);
@@ -379,15 +379,18 @@ static int64_t spond_scanhash(struct thr_info *thr)
 					assert(a->my_jobs[job_id].state == SPONDWORK_STATE_IN_BUSY);
 					a->works_in_minergate_and_pending_tx--;
 					a->works_in_driver--;
-					if (work->winner_nonce) {
-						struct work *cg_work = a->my_jobs[job_id].cgminer_work;
-
+					for (j = 0; j < 2; j++) {
+						if (work->winner_nonce[j]) {
+							bool __maybe_unused ok;
+							struct work *cg_work = a->my_jobs[job_id].cgminer_work;
 #ifndef SP_NTIME
-						submit_nonce(cg_work->thr, cg_work, work->winner_nonce);
+							ok = submit_nonce(cg_work->thr, cg_work, work->winner_nonce[j]);
 #else
-						submit_noffset_nonce(cg_work->thr, cg_work, work->winner_nonce, work->ntime_offset);
+							ok = submit_noffset_nonce(cg_work->thr, cg_work, work->winner_nonce[j], work->ntime_offset);
 #endif
-						a->wins++;
+							//printf("OK on %d:%d = %d\n",work->work_id_in_sw,j, ok);
+							a->wins++;
+						}
 					}
 					//printf("%d ntime_clones = %d\n",job_id,a->my_jobs[job_id].ntime_clones);
 					if ((--a->my_jobs[job_id].ntime_clones) == 0) {
diff --git a/mg_proto_parser.h b/mg_proto_parser.h
index a11c1f6..1476bc2 100644
--- a/mg_proto_parser.h
+++ b/mg_proto_parser.h
@@ -29,7 +29,7 @@
 #define passert assert
 #endif
 
-#define MINERGATE_PROTOCOL_VERSION 5
+#define MINERGATE_PROTOCOL_VERSION 6
 #define MINERGATE_SOCKET_FILE "/tmp/connection_pipe"
 
 typedef enum {
@@ -58,7 +58,7 @@ typedef struct {
 typedef struct {
 	uint32_t work_id_in_sw;
 	uint32_t mrkle_root;     // to validate
-	uint32_t winner_nonce;
+	uint32_t winner_nonce[2];
 	uint8_t  ntime_offset;
 	uint8_t  res;            // 0 = done, 1 = overflow, 2 = dropped bist
 	uint8_t  resrv1;