]> Git Repo - cpuminer-multi.git/commitdiff
stratum: show real target diff for all algos
authorTanguy Pruvot <[email protected]>
Wed, 6 Jan 2016 08:31:52 +0000 (09:31 +0100)
committerTanguy Pruvot <[email protected]>
Wed, 6 Jan 2016 08:37:41 +0000 (09:37 +0100)
some algos use a diff factor, so show the real target value with --show-diff

[2016-01-06 09:35:44] Stratum difficulty set to 1 (0.00002)
[2016-01-06 09:35:44] m7m block 638158, diff 1.255

cpu-miner.c
miner.h
util.c

index ad49aa39e1b117f4d667777f2159a497d99f37b1..9ca8163fca5b5b7cb952acfe9a74d432d5e4102e 100644 (file)
@@ -1651,6 +1651,15 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
                        default:
                                work_set_target(work, sctx->job.diff / opt_diff_factor);
                }
+
+               if (stratum_diff != sctx->job.diff) {
+                       char sdiff[32] = { 0 };
+                       // store for api stats
+                       stratum_diff = sctx->job.diff;
+                       if (opt_showdiff && work->targetdiff != stratum_diff)
+                               snprintf(sdiff, 32, " (%.5f)", work->targetdiff);
+                       applog(LOG_WARNING, "Stratum difficulty set to %g%s", stratum_diff, sdiff);
+               }
        }
 }
 
diff --git a/miner.h b/miner.h
index e169017d01406ba7d6246215d764b76d804f2584..cb17e29f537407a1a7cb656d9773f3de9199411c 100644 (file)
--- a/miner.h
+++ b/miner.h
@@ -454,6 +454,7 @@ void parse_arg(int key, char *arg);
 void parse_config(json_t *config, char *ref);
 void proper_exit(int reason);
 
+void applog_data(void *pdata);
 void applog_hash(void *hash);
 void format_hashrate(double hashrate, char *output);
 void print_hash_tests(void);
diff --git a/util.c b/util.c
index a5150c6d28f83ca5f98c28ea38fc69ef184267be..9ef37b42c35962884818ac136e8e89e2d426e214 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1775,11 +1775,6 @@ static bool stratum_set_difficulty(struct stratum_ctx *sctx, json_t *params)
        sctx->next_diff = diff;
        pthread_mutex_unlock(&sctx->work_lock);
 
-       /* store for api stats */
-       stratum_diff = diff;
-
-       applog(LOG_WARNING, "Stratum difficulty set to %g", diff);
-
        return true;
 }
 
@@ -2053,6 +2048,13 @@ void applog_hash(void *hash)
        applog(LOG_DEBUG, "%s", format_hash(s, (uchar*) hash));
 }
 
+void applog_data(void *pdata)
+{
+       char* hex = abin2hex((uchar*)pdata, 80);
+       applog(LOG_DEBUG, "%s", hex);
+       free(hex);
+}
+
 #define printpfx(n,h) \
        printf("%s%11s%s: %s\n", CL_CYN, n, CL_N, format_hash(s, (uint8_t*) h))
 
This page took 0.034762 seconds and 4 git commands to generate.