Fix debug logging

This commit is contained in:
Stefan Berger 2023-07-20 18:45:29 +02:00
parent f15715f3f3
commit 65b08c4733
2 changed files with 19 additions and 23 deletions

View File

@ -176,15 +176,15 @@ bool parse_mining_notify(String line, mining_job& mJob)
mJob.clean_jobs = doc["params"][8]; //bool mJob.clean_jobs = doc["params"][8]; //bool
#ifdef DEBUG_MINING #ifdef DEBUG_MINING
Serial.print(" job_id: "); Serial.println(job_id); Serial.print(" job_id: "); Serial.println(mJob.job_id);
Serial.print(" prevhash: "); Serial.println(prev_block_hash); Serial.print(" prevhash: "); Serial.println(mJob.prev_block_hash);
Serial.print(" coinb1: "); Serial.println(coinb1); Serial.print(" coinb1: "); Serial.println(mJob.coinb1);
Serial.print(" coinb2: "); Serial.println(coinb2); Serial.print(" coinb2: "); Serial.println(mJob.coinb2);
Serial.print(" merkle_branch size: "); Serial.println(merkle_branches.size()); Serial.print(" merkle_branch size: "); Serial.println(mJob.merkle_branch.size());
Serial.print(" version: "); Serial.println(version); Serial.print(" version: "); Serial.println(mJob.version);
Serial.print(" nbits: "); Serial.println(nbits); Serial.print(" nbits: "); Serial.println(mJob.nbits);
Serial.print(" ntime: "); Serial.println(ntime); Serial.print(" ntime: "); Serial.println(mJob.ntime);
Serial.print(" clean_jobs: "); Serial.println(clean_jobs); Serial.print(" clean_jobs: "); Serial.println(mJob.clean_jobs);
#endif #endif
//Check if parameters where correctly received //Check if parameters where correctly received
if (checkError(doc)) { if (checkError(doc)) {
@ -229,10 +229,6 @@ bool parse_mining_set_difficulty(String line, double& difficulty)
Serial.print(" difficulty: "); Serial.println((double)doc["params"][0],12); Serial.print(" difficulty: "); Serial.println((double)doc["params"][0],12);
difficulty = (double)doc["params"][0]; difficulty = (double)doc["params"][0];
#ifdef DEBUG_MINING
Serial.print(" job_id: "); Serial.println(job_id);
#endif
return true; return true;
} }

View File

@ -201,7 +201,7 @@ miner_data calculateMiningData(mining_subscribe& mWorker, mining_job mJob){
size_t res = to_byte_array(coinbase.c_str(), str_len*2, bytearray); size_t res = to_byte_array(coinbase.c_str(), str_len*2, bytearray);
#ifdef DEBUG_MINING #ifdef DEBUG_MINING
Serial.print(" extranonce2: "); Serial.println(extranonce2); Serial.print(" extranonce2: "); Serial.println(mWorker.extranonce2);
Serial.print(" coinbase: "); Serial.println(coinbase); Serial.print(" coinbase: "); Serial.println(coinbase);
Serial.print(" coinbase bytes - size: "); Serial.println(res); Serial.print(" coinbase bytes - size: "); Serial.println(res);
for (size_t i = 0; i < res; i++) for (size_t i = 0; i < res; i++)
@ -271,7 +271,7 @@ miner_data calculateMiningData(mining_subscribe& mWorker, mining_job mJob){
#ifdef DEBUG_MINING #ifdef DEBUG_MINING
Serial.print(" merkle sha : "); Serial.print(" merkle sha : ");
for (size_t i = 0; i < 32; i++) for (size_t i = 0; i < 32; i++)
Serial.printf("%02x", merkle_result[i]); Serial.printf("%02x", mMiner.merkle_result[i]);
Serial.println(""); Serial.println("");
#endif #endif
} }
@ -330,35 +330,35 @@ miner_data calculateMiningData(mining_subscribe& mWorker, mining_job mJob){
#ifdef DEBUG_MINING #ifdef DEBUG_MINING
Serial.print(" >>> bytearray_blockheader : "); Serial.print(" >>> bytearray_blockheader : ");
for (size_t i = 0; i < 4; i++) for (size_t i = 0; i < 4; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.print("version "); Serial.print("version ");
for (size_t i = 0; i < 4; i++) for (size_t i = 0; i < 4; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.print("prev hash "); Serial.print("prev hash ");
for (size_t i = 4; i < 4+32; i++) for (size_t i = 4; i < 4+32; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.print("merkle root "); Serial.print("merkle root ");
for (size_t i = 36; i < 36+32; i++) for (size_t i = 36; i < 36+32; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.print("nbits "); Serial.print("nbits ");
for (size_t i = 68; i < 68+4; i++) for (size_t i = 68; i < 68+4; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.print("difficulty "); Serial.print("difficulty ");
for (size_t i = 72; i < 72+4; i++) for (size_t i = 72; i < 72+4; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.print("nonce "); Serial.print("nonce ");
for (size_t i = 76; i < 76+4; i++) for (size_t i = 76; i < 76+4; i++)
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
Serial.println(""); Serial.println("");
Serial.println("bytearray_blockheader: "); Serial.println("bytearray_blockheader: ");
for (size_t i = 0; i < str_len; i++) { for (size_t i = 0; i < str_len; i++) {
Serial.printf("%02x", bytearray_blockheader[i]); Serial.printf("%02x", mMiner.bytearray_blockheader[i]);
} }
Serial.println(""); Serial.println("");
#endif #endif