From 2ebfb546a60f547b76549323f8babffeb3c6429d Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 4 Sep 2014 12:41:49 +0200 Subject: [PATCH] clean extra logs, show bloc height on new jobs --- configure.sh | 2 +- cpu-miner.c | 17 +++++++++++------ hashlog.cpp | 4 ++-- miner.h | 1 + util.c | 3 +++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/configure.sh b/configure.sh index 142b59e..9c8b021 100755 --- a/configure.sh +++ b/configure.sh @@ -5,5 +5,5 @@ #--ptxas-options=\"-v -dlcm=cg\"" -CUDA_CFLAGS="-O3" ./configure "CFLAGS=-O3" "CXXFLAGS=-O3" --with-cuda=/usr/local/cuda +CUDA_CFLAGS="-O2" ./configure "CFLAGS=-O2" "CXXFLAGS=-O2" --with-cuda=/usr/local/cuda diff --git a/cpu-miner.c b/cpu-miner.c index 3f772c9..d0dc418 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -918,9 +918,9 @@ static void *miner_thread(void *userdata) g_work_time = time(NULL); } } - if (memcmp(work.data, g_work.data, 72)) { // wcmplen)) { + if (memcmp(work.data, g_work.data, wcmplen)) { if (opt_debug) { - applog(LOG_DEBUG, "job %s %08x work updated", g_work.job_id, (*nonceptr)); + applog(LOG_DEBUG, "job %s work updated", g_work.job_id); for (int n=0; n %x %x", jobid, - scanned_from, scanned_to, data.scanned_from, data.scanned_to);/* */ +/* applog(LOG_BLUE, "job %s range : %x %x -> %x %x", jobid, + scanned_from, scanned_to, data.scanned_from, data.scanned_to); */ } /** diff --git a/miner.h b/miner.h index 098b6d5..5e36442 100644 --- a/miner.h +++ b/miner.h @@ -380,6 +380,7 @@ struct stratum_ctx { pthread_mutex_t work_lock; int srvtime_diff; + int bloc_height; }; bool stratum_socket_full(struct stratum_ctx *sctx, int timeout); diff --git a/util.c b/util.c index 9afc308..7927d18 100644 --- a/util.c +++ b/util.c @@ -1069,10 +1069,13 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) coinb2_size = strlen(coinb2) / 2; sctx->job.coinbase_size = coinb1_size + sctx->xnonce1_size + sctx->xnonce2_size + coinb2_size; + sctx->job.coinbase = (unsigned char*)realloc(sctx->job.coinbase, sctx->job.coinbase_size); sctx->job.xnonce2 = sctx->job.coinbase + coinb1_size + sctx->xnonce1_size; hex2bin(sctx->job.coinbase, coinb1, coinb1_size); memcpy(sctx->job.coinbase + coinb1_size, sctx->xnonce1, sctx->xnonce1_size); + + sctx->bloc_height = le16dec((uint8_t*) sctx->job.coinbase + 43); if (!sctx->job.job_id || strcmp(sctx->job.job_id, job_id)) memset(sctx->job.xnonce2, 0, sctx->xnonce2_size); hex2bin(sctx->job.xnonce2 + sctx->xnonce2_size, coinb2, coinb2_size);