From 0a7d287c40c992b3ef5722c2cae54c6b18e6d083 Mon Sep 17 00:00:00 2001 From: Matt Hess Date: Mon, 8 Dec 2025 23:56:25 +0000 Subject: [PATCH] Moved verbose DEBUG and diagnostic logging from level 0 to level 6 to reduce console spam during normal operation --- src/carrot_crypto.cpp | 2 +- src/p2p_server.cpp | 2 +- src/p2pool.cpp | 8 ++++---- src/pool_block.cpp | 24 ++++++++++++------------ src/pool_block_parser.inl | 8 ++++---- src/side_chain.cpp | 8 ++++---- src/stratum_server.cpp | 4 ++-- src/wallet.cpp | 8 ++++---- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/carrot_crypto.cpp b/src/carrot_crypto.cpp index babfe08..39b8922 100644 --- a/src/carrot_crypto.cpp +++ b/src/carrot_crypto.cpp @@ -84,7 +84,7 @@ static void debug_hex(const char* label, const uint8_t* data, size_t len) for (size_t i = 0; i < len && i < 64; ++i) { sprintf(hex + i*2, "%02x", data[i]); } - LOGINFO(0, label << ": " << static_cast(hex)); + LOGINFO(6, label << ": " << static_cast(hex)); } // BLAKE2b keyed hash wrapper diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index 4e02eac..7be444e 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -2524,7 +2524,7 @@ bool P2PServer::P2PClient::on_handshake_challenge(const uint8_t* buf) uint64_t peer_id; memcpy(&peer_id, buf + CHALLENGE_SIZE, sizeof(uint64_t)); - LOGINFO(0, "DEBUG: Received handshake from " << static_cast(m_addrString) + LOGINFO(6, "DEBUG: Received handshake from " << static_cast(m_addrString) << " peer_id=" << peer_id << " my_id=" << server->get_peerId(false) << " my_tor_id=" << server->get_peerId(true)); diff --git a/src/p2pool.cpp b/src/p2pool.cpp index 51c4945..9ba215d 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -1121,7 +1121,7 @@ void p2pool::submit_block() const snprintf(buf, sizeof(buf), "%02x", submit_data.blob[i]); hex.append(buf); } - LOGINFO(0, "DEBUG BLOCK BLOB: " << hex); + LOGINFO(6, "DEBUG BLOCK BLOB: " << hex); if (submit_data.blob.empty()) { LOGERR(0, "submit_block: couldn't find block template with id " << submit_data.template_id); @@ -1145,7 +1145,7 @@ void p2pool::submit_block() const std::vector blob; blob.reserve(submit_data.blob.size()); - LOGINFO(0, "DEBUG submit_block offsets: nonce_offset=" << nonce_offset + LOGINFO(6, "DEBUG submit_block offsets: nonce_offset=" << nonce_offset << ", extra_nonce_offset=" << extra_nonce_offset << ", merkle_root_offset=" << merkle_root_offset << ", blob_size=" << submit_data.blob.size()); @@ -1158,7 +1158,7 @@ void p2pool::submit_block() const else if (extra_nonce_offset && extra_nonce_offset <= i && i < extra_nonce_offset + sizeof(extra_nonce)) { b = (extra_nonce >> ((i - extra_nonce_offset) * 8)) & 255; if (i == extra_nonce_offset) { - LOGINFO(0, "DEBUG: Patching extra_nonce at offset " << i << ", value=" << extra_nonce); + LOGINFO(6, "DEBUG: Patching extra_nonce at offset " << i << ", value=" << extra_nonce); } } @@ -1178,7 +1178,7 @@ void p2pool::submit_block() const // DEBUG: Show what we're actually sending std::string sent_blob_hex = request.substr(request.find("\":[\"")+4, 400); - LOGINFO(0, "DEBUG: First 200 bytes of hex being sent: " << sent_blob_hex.substr(0, 400)); + LOGINFO(6, "DEBUG: First 200 bytes of hex being sent: " << sent_blob_hex.substr(0, 400)); hash digest; sha256(blob.data(), static_cast(blob.size()), digest.h); diff --git a/src/pool_block.cpp b/src/pool_block.cpp index cab589d..6bf9f3f 100644 --- a/src/pool_block.cpp +++ b/src/pool_block.cpp @@ -178,25 +178,25 @@ std::vector PoolBlock::serialize_mainchain_data(size_t* header_size, si writeVarint(m_outputAmounts.size(), data); - LOGINFO(0, "DEBUG serialize: numOutputs=" << m_outputAmounts.size() << " numEphKeys=" << m_ephPublicKeys.size() << " numViewTags=" << m_viewTags.size() << " numEncAnchors=" << m_encryptedAnchors.size() << " sidechainHeight=" << m_sidechainHeight); + LOGINFO(6, "DEBUG serialize: numOutputs=" << m_outputAmounts.size() << " numEphKeys=" << m_ephPublicKeys.size() << " numViewTags=" << m_viewTags.size() << " numEncAnchors=" << m_encryptedAnchors.size() << " sidechainHeight=" << m_sidechainHeight); if (!m_ephPublicKeys.empty()) { - LOGINFO(0, "DEBUG serialize K_o[0]=" << m_ephPublicKeys[0]); + LOGINFO(6, "DEBUG serialize K_o[0]=" << m_ephPublicKeys[0]); } if (!m_viewTags.empty() && m_viewTags[0].size() >= 3) { char buf[16]; snprintf(buf, sizeof(buf), "%02x%02x%02x", m_viewTags[0][0], m_viewTags[0][1], m_viewTags[0][2]); - LOGINFO(0, "DEBUG serialize viewTag[0]=" << (const char*)buf); + LOGINFO(6, "DEBUG serialize viewTag[0]=" << (const char*)buf); } if (!m_encryptedAnchors.empty() && m_encryptedAnchors[0].size() >= 16) { std::string hex; for (int i = 0; i < 16; ++i) { char buf[4]; snprintf(buf, sizeof(buf), "%02x", m_encryptedAnchors[0][i]); hex += buf; } - LOGINFO(0, "DEBUG serialize encAnchor[0]=" << hex); + LOGINFO(6, "DEBUG serialize encAnchor[0]=" << hex); } - LOGINFO(0, "DEBUG serialize D_e=" << m_txkeyPub); + LOGINFO(6, "DEBUG serialize D_e=" << m_txkeyPub); - LOGINFO(0, "DEBUG serialize merkleRoot=" << static_cast(m_merkleRoot)); + LOGINFO(6, "DEBUG serialize merkleRoot=" << static_cast(m_merkleRoot)); for (size_t i = 0, n = m_outputAmounts.size(); i < n; ++i) { const TxOutput& output = m_outputAmounts[i]; @@ -322,7 +322,7 @@ std::vector PoolBlock::serialize_mainchain_data(size_t* header_size, si writeVarint(m_transactions.size() - 1, data); if (m_transactions.size() > 1) { - LOGINFO(0, "DEBUG serialize tx: m_transactions[1]=" << m_transactions[1] << " sidechainHeight=" << m_sidechainHeight); + LOGINFO(6, "DEBUG serialize tx: m_transactions[1]=" << m_transactions[1] << " sidechainHeight=" << m_sidechainHeight); } #ifdef WITH_INDEXED_HASHES @@ -481,7 +481,7 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const const uint8_t* miner_tx = mainchain_data.data() + header_size; // DEBUG: dump miner TX for comparison - LOGINFO(0, "get_pow_hash: header_size=" << header_size << " miner_tx_size=" << miner_tx_size); + LOGINFO(6, "get_pow_hash: header_size=" << header_size << " miner_tx_size=" << miner_tx_size); { std::string hex_dump; for (size_t dbg_i = 0; dbg_i < std::min(miner_tx_size, size_t(160)); ++dbg_i) { @@ -489,7 +489,7 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const snprintf(dbg_buf, sizeof(dbg_buf), "%02x", miner_tx[dbg_i]); hex_dump += dbg_buf; } - LOGINFO(0, "miner_tx bytes: " << hex_dump); + LOGINFO(6, "miner_tx bytes: " << hex_dump); } hash tmp; @@ -506,7 +506,7 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const m_transactions[0] = static_cast(tmp); // DEBUG: dump m_transactions for comparison - LOGINFO(0, "get_pow_hash: m_transactions.size()=" << m_transactions.size()); + LOGINFO(6, "get_pow_hash: m_transactions.size()=" << m_transactions.size()); for (size_t dbg_i = 0; dbg_i < m_transactions.size(); ++dbg_i) { const hash& dbg_h = m_transactions[dbg_i]; std::string hex; @@ -515,7 +515,7 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const snprintf(buf, sizeof(buf), "%02x", dbg_h.h[j]); hex += buf; } - LOGINFO(0, "get_pow_hash: m_transactions[" << dbg_i << "]=" << hex); + LOGINFO(6, "get_pow_hash: m_transactions[" << dbg_i << "]=" << hex); } root_hash tmp_root; @@ -549,7 +549,7 @@ bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const snprintf(buf, sizeof(buf), "%02x", blob[i]); hex += buf; } - LOGINFO(0, "DEBUG hashing blob (" << blob_size << " bytes): " << hex); + LOGINFO(6, "DEBUG hashing blob (" << blob_size << " bytes): " << hex); } return hasher->calculate(blob, blob_size, height, seed_hash, pow_hash, force_light_mode); diff --git a/src/pool_block_parser.inl b/src/pool_block_parser.inl index ba07737..2a518be 100644 --- a/src/pool_block_parser.inl +++ b/src/pool_block_parser.inl @@ -574,7 +574,7 @@ skip_protocol_tx: if (transactions_blob_size > 0) { hash tx_h; memcpy(tx_h.h, transactions_blob, HASH_SIZE); - LOGINFO(0, "DEBUG transactions_blob first hash: " << tx_h); + LOGINFO(6, "DEBUG transactions_blob first hash: " << tx_h); } #if POOL_BLOCK_DEBUG @@ -586,7 +586,7 @@ skip_protocol_tx: const std::vector& consensus_id = sidechain.consensus_id(); const int data_size = static_cast((data_end - data_begin) + outputs_blob_size_diff + transactions_blob_size_diff); - LOGINFO(0, "DEBUG hash params: data_size=" << data_size << " outputs_offset=" << outputs_offset << " outputs_blob_size=" << outputs_blob_size << " outputs_blob_size_diff=" << outputs_blob_size_diff << " transactions_offset=" << transactions_offset << " transactions_blob_size=" << transactions_blob_size << " transactions_blob_size_diff=" << transactions_blob_size_diff << " nonce_offset=" << nonce_offset << " extra_nonce_offset=" << extra_nonce_offset << " mm_root_hash_offset=" << mm_root_hash_offset << " consensus_id_size=" << consensus_id.size()); + LOGINFO(6, "DEBUG hash params: data_size=" << data_size << " outputs_offset=" << outputs_offset << " outputs_blob_size=" << outputs_blob_size << " outputs_blob_size_diff=" << outputs_blob_size_diff << " transactions_offset=" << transactions_offset << " transactions_blob_size=" << transactions_blob_size << " transactions_blob_size_diff=" << transactions_blob_size_diff << " nonce_offset=" << nonce_offset << " extra_nonce_offset=" << extra_nonce_offset << " mm_root_hash_offset=" << mm_root_hash_offset << " consensus_id_size=" << consensus_id.size()); if (data_size > static_cast(MAX_BLOCK_SIZE)) { return __LINE__; @@ -650,10 +650,10 @@ skip_protocol_tx: snprintf(buf, sizeof(buf), "%02x", outputs_blob[i]); hex += buf; } - LOGINFO(0, "DEBUG parser outputs_blob (first 64): " << hex << " size=" << outputs_blob.size()); + LOGINFO(6, "DEBUG parser outputs_blob (first 64): " << hex << " size=" << outputs_blob.size()); } - LOGINFO(0, "DEBUG merkle verify: sidechain_height=" << m_sidechainHeight << " mm_aux_slot=" << mm_aux_slot << " n_chains=" << mm_n_aux_chains << " proof_size=" << m_merkleProof.size() << " check=" << check << " merkleRoot=" << static_cast(m_merkleRoot)); + LOGINFO(6, "DEBUG merkle verify: sidechain_height=" << m_sidechainHeight << " mm_aux_slot=" << mm_aux_slot << " n_chains=" << mm_n_aux_chains << " proof_size=" << m_merkleProof.size() << " check=" << check << " merkleRoot=" << static_cast(m_merkleRoot)); if (!verify_merkle_proof(check, m_merkleProof, mm_aux_slot, mm_n_aux_chains, m_merkleRoot)) { return __LINE__; diff --git a/src/side_chain.cpp b/src/side_chain.cpp index e95de83..ac35eb3 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -472,7 +472,7 @@ bool SideChain::get_shares(const PoolBlock* tip, std::vector& shares } pplns_weight += cur_weight; - LOGINFO(0, "get_shares: height=" << cur->m_sidechainHeight << " wallet=" << cur->m_minerWallet << " pplns_weight=" << pplns_weight << " max=" << max_pplns_weight << " mainchain_h=" << tip->m_txinGenHeight << " depth=" << block_depth); + LOGINFO(6, "get_shares: height=" << cur->m_sidechainHeight << " wallet=" << cur->m_minerWallet << " pplns_weight=" << pplns_weight << " max=" << max_pplns_weight << " mainchain_h=" << tip->m_txinGenHeight << " depth=" << block_depth); // One non-uncle share can go above the limit, but it will also guarantee that "shares" is never empty if (pplns_weight > max_pplns_weight) { @@ -625,7 +625,7 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector& missing_ return false; } - LOGINFO(0, "DEBUG get_pow_hash: seed=" << block.m_seed << " txinGenHeight=" << block.m_txinGenHeight); + LOGINFO(6, "DEBUG get_pow_hash: seed=" << block.m_seed << " txinGenHeight=" << block.m_txinGenHeight); if (!block.get_pow_hash(m_pool->hasher(), block.m_txinGenHeight, block.m_seed, block.m_powHash)) { LOGWARN(3, "add_external_block: couldn't get PoW hash for height = " << block.m_sidechainHeight << ", mainchain height " << block.m_txinGenHeight << ". Ignoring it."); @@ -650,7 +650,7 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector& missing_ } } - LOGINFO(0, "DEBUG PoW check: sidechainHeight=" << block.m_sidechainHeight << " m_difficulty.lo=" << block.m_difficulty.lo << " m_difficulty.hi=" << block.m_difficulty.hi << " m_powHash=" << block.m_powHash); + LOGINFO(6, "DEBUG PoW check: sidechainHeight=" << block.m_sidechainHeight << " m_difficulty.lo=" << block.m_difficulty.lo << " m_difficulty.hi=" << block.m_difficulty.hi << " m_powHash=" << block.m_powHash); if (!block.m_difficulty.check_pow(block.m_powHash)) { LOGWARN(3, @@ -885,7 +885,7 @@ const PoolBlock* SideChain::get_block_blob(const hash& id, std::vector& snprintf(buf, sizeof(buf), "%02x", blob[i]); hex += buf; } - LOGINFO(0, "DEBUG get_block_blob outputs area (64 bytes from offset 43): " << hex); + LOGINFO(6, "DEBUG get_block_blob outputs area (64 bytes from offset 43): " << hex); } const std::vector sidechain_data = block->serialize_sidechain_data(); blob.insert(blob.end(), sidechain_data.begin(), sidechain_data.end()); diff --git a/src/stratum_server.cpp b/src/stratum_server.cpp index 1036dda..5e8da32 100644 --- a/src/stratum_server.cpp +++ b/src/stratum_server.cpp @@ -984,7 +984,7 @@ void StratumServer::on_share_found(uv_work_t* req) hash pow_hash; - LOGINFO(0, "DEBUG stratum hash: height=" << height << " seed=" << seed_hash << " blob_size=" << blob_size); + LOGINFO(6, "DEBUG stratum hash: height=" << height << " seed=" << seed_hash << " blob_size=" << blob_size); { std::string hex; @@ -993,7 +993,7 @@ void StratumServer::on_share_found(uv_work_t* req) snprintf(buf, sizeof(buf), "%02x", blob[i]); hex += buf; } - LOGINFO(0, "DEBUG stratum blob: " << hex); + LOGINFO(6, "DEBUG stratum blob: " << hex); } if (!pool->calculate_hash(blob, blob_size, height, seed_hash, pow_hash, false)) { diff --git a/src/wallet.cpp b/src/wallet.cpp index d43bfba..d4c5047 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -212,10 +212,10 @@ bool Wallet::decode(const char* address) sprintf(data_hex + i*2, "%02x", data[i]); } sprintf(prefix_hex, "0x%lx", m_prefix); - LOGINFO(0, "decode varint_len=" << varint_len << " data_index=" << data_index << " prefix=" << static_cast(prefix_hex)); - LOGINFO(0, "decode raw_data: " << static_cast(data_hex)); - LOGINFO(0, "decode spend: " << static_cast(spend_hex)); - LOGINFO(0, "decode view: " << static_cast(view_hex)); + LOGINFO(6, "decode varint_len=" << varint_len << " data_index=" << data_index << " prefix=" << static_cast(prefix_hex)); + LOGINFO(6, "decode raw_data: " << static_cast(data_hex)); + LOGINFO(6, "decode spend: " << static_cast(spend_hex)); + LOGINFO(6, "decode view: " << static_cast(view_hex)); } // Load checksum from correct position (at end of decoded data)