From 4a52d0553b0076b984be480725fa67689c544647 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 1 Sep 2014 10:22:32 +0200 Subject: [PATCH] debug: show json methods, hide hash/target if ok --- util.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/util.c b/util.c index f947d37..6fd2b71 100644 --- a/util.c +++ b/util.c @@ -559,7 +559,7 @@ bool fulltest(const uint32_t *hash, const uint32_t *target) } } - if (opt_debug) { + if (!rc || opt_debug) { uint32_t hash_be[8], target_be[8]; char *hash_str, *target_str; @@ -572,7 +572,7 @@ bool fulltest(const uint32_t *hash, const uint32_t *target) applog(LOG_DEBUG, "DEBUG: %s\nHash: %s\nTarget: %s", rc ? "hash <= target" - : "hash > target (false positive)", + : CL_YLW "hash > target (false positive)" CL_N, hash_str, target_str); @@ -1205,6 +1205,10 @@ bool stratum_handle_method(struct stratum_ctx *sctx, const char *s) id = json_object_get(val, "id"); params = json_object_get(val, "params"); + if (opt_debug) { + applog(LOG_DEBUG, "method: %s", s); + } + if (!strcasecmp(method, "mining.notify")) { ret = stratum_notify(sctx, params); goto out; @@ -1368,7 +1372,8 @@ extern void applog_hash(unsigned char *hash) void print_hash_tests(void) { - unsigned char buf[128], hash[128], s[128]; + char s[128] = {'\0'}; + unsigned char buf[128], hash[128]; memset(buf, 0, sizeof buf); printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n");