Browse Source

Merge commit '13676ef' into stratum

Luke Dashjr 13 years ago
parent
commit
5d5fbad6ce
3 changed files with 17 additions and 9 deletions
  1. 12 0
      README
  2. 4 8
      miner.c
  3. 1 1
      util.c

+ 12 - 0
README

@@ -385,6 +385,18 @@ Thread 1: 60.2 Mh/s Enabled ALIVE
 Or press any other key to continue
 
 
+The running log shows output like this:
+
+ [2012-10-12 15:38:17] Accepted 78bb4861 Diff 2/1 GPU 1 pool 6
+ [2012-10-12 15:38:17] Accepted f99b2b7a Diff 4/1 GPU 2 pool 6
+ [2012-10-12 15:38:23] Accepted af298bef Diff 4/1 GPU 0 pool 6
+ [2012-10-12 15:38:24] Accepted d04421af Diff 5/1 GPU 0 pool 6
+ [2012-10-12 15:38:25] Accepted c18e5b5b Diff 4/1 GPU 3 pool 6
+
+The 8 byte hex value are the 2nd 8 bytes of the share being submitted to the
+pool. The 2 diff values are the actual difficulty target that share reached
+followed by the difficulty target the pool is currently asking for.
+
 ---
 Also many issues and FAQs are covered in the forum thread
 dedicated to this program,

+ 4 - 8
miner.c

@@ -1850,7 +1850,7 @@ static void suffix_string(uint64_t val, char *buf, int sigdigits)
 	if (!sigdigits)
 		sprintf(buf, "%d%s", (unsigned int)dval, suffix);
 	else
-		sprintf(buf, "%.*g%s", sigdigits, dval, suffix);
+		sprintf(buf, "%-*.*g%s", sigdigits + 1, sigdigits, dval, suffix);
 }
 
 static float
@@ -2418,16 +2418,12 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
 static uint64_t share_diff(const struct work *work)
 {
 	const uint64_t h64 = 0xFFFF000000000000ull;
-	char rtarget[33], *target;
 	uint64_t *data64, d64;
+	char rhash[33];
 	uint64_t ret;
 
-	target = bin2hex(work->hash, 32);
-	if (unlikely(!target))
-		quit(1, "Failed to bin2hex in share_diff");
-	swab256(rtarget, target);
-	free(target);
-	data64 = (uint64_t *)(rtarget + 4);
+	swab256(rhash, work->hash);
+	data64 = (uint64_t *)(rhash + 4);
 	d64 = be64toh(*data64);
 	if (unlikely(!d64))
 		d64 = 1;

+ 1 - 1
util.c

@@ -816,7 +816,7 @@ bool extract_sockaddr(struct pool *pool, char *url)
 	sprintf(url_address, "%.*s", url_len, url_begin);
 
 	if (port_len)
-		sprintf(port, "%.*s", port_len, port_start);
+		snprintf(port, 6, "%.*s", port_len, port_start);
 	else
 		strcpy(port, "80");