Browse Source

Generate header created from stratum structures in gen_stratum_work.

Con Kolivas 13 years ago
parent
commit
e1468cc5fd
1 changed files with 10 additions and 1 deletions
  1. 10 1
      cgminer.c

+ 10 - 1
cgminer.c

@@ -4276,7 +4276,7 @@ static void gen_hash(unsigned char *data, unsigned char *hash, int len)
 static void gen_stratum_work(struct pool *pool, struct work *work)
 {
 	unsigned char merkle_root[32], merkle_sha[64], *merkle_hash;
-	char *coinbase, *nonce2;
+	char header[256], *coinbase, *nonce2;
 	uint32_t *data32, *swap32;
 	int len, i;
 
@@ -4310,10 +4310,19 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 		swap32[i] = swab32(data32[i]);
 	merkle_hash = (unsigned char *)bin2hex((const unsigned char *)merkle_root, 32);
 
+	sprintf(header, "%s", pool->swork.bbversion);
+	strcat(header, pool->swork.prev_hash);
+	strcat(header, (char *)merkle_hash);
+	strcat(header, pool->swork.ntime);
+	strcat(header, pool->swork.nbit);
+	strcat(header, "00000000"); /* nonce */
+	strcat(header, "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000");
+
 	mutex_unlock(&pool->pool_lock);
 
 	applog(LOG_DEBUG, "Generated stratum coinbase %s", coinbase);
 	applog(LOG_DEBUG, "Generated stratum merkle %s", merkle_hash);
+	applog(LOG_DEBUG, "Generated stratum header %s", header);
 
 	free(merkle_hash);
 }