Browse Source

Combine shared padding into one char.

Con Kolivas 13 years ago
parent
commit
52b4bae961
1 changed files with 4 additions and 2 deletions
  1. 4 2
      cgminer.c

+ 4 - 2
cgminer.c

@@ -1550,6 +1550,8 @@ static void update_gbt(struct pool *pool)
 	curl_easy_cleanup(curl);
 	curl_easy_cleanup(curl);
 }
 }
 
 
+static char *workpadding = "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000";
+
 static void gen_gbt_work(struct pool *pool, struct work *work)
 static void gen_gbt_work(struct pool *pool, struct work *work)
 {
 {
 	unsigned char *merkleroot;
 	unsigned char *merkleroot;
@@ -1584,7 +1586,7 @@ static void gen_gbt_work(struct pool *pool, struct work *work)
 	free(merkleroot);
 	free(merkleroot);
 	memset(work->data + 4 + 32 + 32 + 4 + 4, 0, 4); /* nonce */
 	memset(work->data + 4 + 32 + 32 + 4 + 4, 0, 4); /* nonce */
 
 
-	hex2bin(work->data + 4 + 32 + 32 + 4 + 4 + 4, "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000", 48);
+	hex2bin(work->data + 4 + 32 + 32 + 4 + 4 + 4, workpadding, 48);
 
 
 	if (opt_debug) {
 	if (opt_debug) {
 		char *header = bin2hex(work->data, 128);
 		char *header = bin2hex(work->data, 128);
@@ -5318,7 +5320,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 	header = realloc_strcat(header, pool->swork.ntime);
 	header = realloc_strcat(header, pool->swork.ntime);
 	header = realloc_strcat(header, pool->swork.nbit);
 	header = realloc_strcat(header, pool->swork.nbit);
 	header = realloc_strcat(header, "00000000"); /* nonce */
 	header = realloc_strcat(header, "00000000"); /* nonce */
-	header = realloc_strcat(header, "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000");
+	header = realloc_strcat(header, workpadding);
 
 
 	/* Store the stratum work diff to check it still matches the pool's
 	/* Store the stratum work diff to check it still matches the pool's
 	 * stratum diff when submitting shares */
 	 * stratum diff when submitting shares */