diff --git a/mining_loop.c b/mining_loop.c index 686304c..b2ed8eb 100644 --- a/mining_loop.c +++ b/mining_loop.c @@ -123,7 +123,9 @@ int run_mining_loop(const MinerConfig *cfg, int worker_idx, const char *extranon return 1; } - fprintf(stdout, "[main] chain=%s worker=%d extranonce2=%s\n", chain, worker_idx, extranonce2); + if (event_fd < 0) { + fprintf(stdout, "[main] chain=%s worker=%d extranonce2=%s\n", chain, worker_idx, extranonce2); + } status_ctx.event_fd = event_fd; status_ctx.worker_idx = worker_idx; @@ -164,7 +166,9 @@ int run_mining_loop(const MinerConfig *cfg, int worker_idx, const char *extranon } } - fprintf(stdout, "[main] template height=%d tx=%zu segwit=%d\n", tpl.height, tpl.tx_count, witness_count); + if (event_fd < 0) { + fprintf(stdout, "[main] template height=%d tx=%zu segwit=%d\n", tpl.height, tpl.tx_count, witness_count); + } if (build_coinbase_transaction( &tpl, @@ -243,7 +247,7 @@ int run_mining_loop(const MinerConfig *cfg, int worker_idx, const char *extranon putchar('\n'); } - if (atomic_load(&new_block_flag) != 0) { + if (event_fd < 0 && atomic_load(&new_block_flag) != 0) { fprintf(stdout, "[main] nuovo best block: riavvio ciclo\n"); } @@ -283,7 +287,9 @@ int run_mining_loop(const MinerConfig *cfg, int worker_idx, const char *extranon } if (block_hash != NULL) { - fprintf(stdout, "[main] block trovato: %s\n", block_hash); + if (event_fd < 0) { + fprintf(stdout, "[main] block trovato: %s\n", block_hash); + } emit_eventf(event_fd, "found %d %.6f\n", worker_idx, result.hashrate_hz / 1000.0); emit_eventf(event_fd, "hash %d %s\n", worker_idx, block_hash); }