Browse Source

Stratum: Treat ntime as uint32_t (as it should be), still always big endian

Luke Dashjr 12 years ago
parent
commit
39fa94e8f9
3 changed files with 3 additions and 4 deletions
  1. 1 2
      miner.c
  2. 1 1
      miner.h
  3. 1 1
      util.c

+ 1 - 2
miner.c

@@ -7221,8 +7221,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
 	
 	memcpy(&work->data[0], pool->swork.header1, 36);
 	memcpy(&work->data[36], merkle_root, 32);
-	*((uint32_t*)&work->data[68]) = 0; // FIXME: big endian time
-	memcpy(&work->data[68], pool->swork.ntime, 4);
+	*((uint32_t*)&work->data[68]) = pool->swork.ntime;
 	memcpy(&work->data[72], pool->swork.diffbits, 4);
 	memset(&work->data[76], 0, 4);  // nonce
 	memcpy(&work->data[80], workpadding_bin, 48);

+ 1 - 1
miner.h

@@ -1088,7 +1088,7 @@ struct stratum_work {
 	
 	uint8_t header1[36];
 	uint8_t diffbits[4];
-	uint8_t ntime[4];
+	uint32_t ntime;  // Always big endian
 
 	double diff;
 

+ 1 - 1
util.c

@@ -1675,7 +1675,7 @@ static bool parse_notify(struct pool *pool, json_t *val)
 	
 	hex2bin(&pool->swork.header1[0], bbversion,  4);
 	hex2bin(&pool->swork.header1[4], prev_hash, 32);
-	hex2bin(&pool->swork.ntime[0], ntime, 4);
+	hex2bin((void*)&pool->swork.ntime, ntime, 4);
 	hex2bin(&pool->swork.diffbits[0], nbit, 4);
 	
 	cb1_len = strlen(coinbase1) / 2;