Browse Source

Merge commit '598ee76' into cg_merges_20121115

Conflicts:
	miner.c
Luke Dashjr 13 years ago
parent
commit
118c68471c
3 changed files with 10 additions and 15 deletions
  1. 7 3
      driver-cpu.c
  2. 3 11
      miner.c
  3. 0 1
      miner.h

+ 7 - 3
driver-cpu.c

@@ -226,6 +226,7 @@ double bench_algo_stage3(
 	// Use a random work block pulled from a pool
 	static uint8_t bench_block[] = { CGMINER_BENCHMARK_BLOCK };
 	struct work work __attribute__((aligned(128)));
+	unsigned char hash1[64];
 
 	size_t bench_size = sizeof(work);
 	size_t work_size = sizeof(bench_block);
@@ -240,6 +241,8 @@ double bench_algo_stage3(
 	uint32_t max_nonce = (1<<22);
 	uint32_t last_nonce = 0;
 
+	hex2bin(hash1, "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000", 64);
+
 	gettimeofday(&start, 0);
 			{
 				sha256_func func = sha256_funcs[algo];
@@ -247,7 +250,7 @@ double bench_algo_stage3(
 					&dummy,
 					work.midstate,
 					work.data,
-					work.hash1,
+					hash1,
 					work.hash,
 					work.target,
 					max_nonce,
@@ -806,11 +809,12 @@ static bool cpu_thread_init(struct thr_info *thr)
 static int64_t cpu_scanhash(struct thr_info *thr, struct work *work, int64_t max_nonce)
 {
 	const int thr_id = thr->id;
-
+	unsigned char hash1[64];
 	uint32_t first_nonce = work->blk.nonce;
 	uint32_t last_nonce;
 	bool rc;
 
+	hex2bin(hash1, "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000", 64);
 CPUSearch:
 	last_nonce = first_nonce;
 	rc = false;
@@ -822,7 +826,7 @@ CPUSearch:
 			thr,
 			work->midstate,
 			work->data,
-			work->hash1,
+			hash1,
 			work->hash,
 			work->target,
 			max_nonce,

+ 3 - 11
miner.c

@@ -126,7 +126,7 @@ const int opt_cutofftemp = 95;
 int opt_hysteresis = 3;
 static int opt_retries = -1;
 int opt_fail_pause = 5;
-int opt_log_interval = 5;
+int opt_log_interval = 3;
 int opt_queue = 1;
 int opt_scantime = 60;
 int opt_expiry = 120;
@@ -147,7 +147,7 @@ bool opt_scrypt;
 #else
 static char detect_algo;
 #endif
-bool opt_restart = true;
+bool opt_restart;
 static bool opt_nogpu;
 
 struct list_head scan_devices;
@@ -1731,11 +1731,6 @@ static bool work_decode(struct pool *pool, struct work *work, json_t *val)
 		calc_midstate(work);
 	}
 
-	if (!jobj_binary(res_val, "hash1", work->hash1, sizeof(work->hash1), false)) {
-		// Always the same anyway
-		memcpy(work->hash1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0", 64);
-	}
-
 	if (unlikely(!jobj_binary(res_val, "target", work->target, sizeof(work->target), true))) {
 		applog(LOG_ERR, "JSON inval target");
 		return false;
@@ -5953,8 +5948,8 @@ static void set_work_target(struct work *work, double diff)
 static void gen_stratum_work(struct pool *pool, struct work *work)
 {
 	unsigned char *coinbase, merkle_root[36], merkle_sha[68], *merkle_hash;
-	char header[260], hash1[132], *nonce2;
 	int len, cb1_len, n1_len, cb2_len, i;
+	char header[260], *nonce2;
 	uint32_t *data32, *swap32;
 
 	memset(work->job_id, 0, 64);
@@ -6023,9 +6018,6 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 	if (unlikely(!hex2bin(work->data, header, 128)))
 		quit(1, "Failed to convert header to data in gen_stratum_work");
 	calc_midstate(work);
-	sprintf(hash1, "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000");
-	if (unlikely(!hex2bin(work->hash1, hash1, 64)))
-		quit(1,  "Failed to convert hash1 in gen_stratum_work");
 
 	set_work_target(work, work->sdiff);
 

+ 0 - 1
miner.h

@@ -1005,7 +1005,6 @@ struct pool {
 
 struct work {
 	unsigned char	data[128];
-	unsigned char	hash1[64];
 	unsigned char	midstate[32];
 	unsigned char	target[32];
 	unsigned char	hash[32];