Skip to content

Commit fec4aa1

Browse files
committed
Tag final batch: Factory, PoolNode, submitblock, Stratum traces
[Net] Factory connect/resolve failures (demoted handshake to TRACE) [CoinP2P] Version handshake, connection events [P2Pool] PoolNode errors, peer connect events [LTC] submitblock traces (received/merkle/relay/stale) [Stratum] mining.submit trace, message received trace Now every runtime log line has a protocol/chain prefix. Startup/config messages are the only untagged lines (intentional).
1 parent ec8c08c commit fec4aa1

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/core/factory.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ class Client
9595
if (ec)
9696
{
9797
if (ec != boost::system::errc::operation_canceled)
98-
LOG_WARNING << "Factory::Client::connect_socket failed: " << ec.message();
98+
LOG_WARNING << "[Net] Connection failed: " << ec.message();
9999
else
100100
LOG_DEBUG_COIND << "Factory::Client::connect_socket canceled";
101101
return;
102102
}
103103

104-
LOG_INFO << "Factory::Client::connect_socket try handshake with " << ep.address() << ":" << ep.port();
104+
LOG_TRACE << "[Net] Handshake with " << ep.address() << ":" << ep.port();
105105
socket->init();
106106

107107
m_node->connected(socket);
@@ -118,7 +118,7 @@ class Client
118118
{
119119

120120
if (ec != boost::system::errc::operation_canceled)
121-
LOG_WARNING << "Factory::Client::resolve failed: " << ec.message();
121+
LOG_WARNING << "[Net] DNS resolve failed: " << ec.message();
122122
else
123123
LOG_DEBUG_OTHER << "Factory::Client::resolve canceled";
124124
return;

src/core/web_server.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,11 +1715,11 @@ nlohmann::json MiningInterface::getblocktemplate(const nlohmann::json& params, c
17151715

17161716
nlohmann::json MiningInterface::submitblock(const std::string& hex_data, const std::string& request_id)
17171717
{
1718-
LOG_TRACE << "submitblock: received " << hex_data.length() / 2 << " bytes";
1718+
LOG_TRACE << "[LTC] submitblock: received " << hex_data.length() / 2 << " bytes";
17191719

17201720
// Block header is 80 bytes = 160 hex chars minimum
17211721
if (hex_data.size() < 160) {
1722-
LOG_ERROR << "submitblock: hex data too short for a valid block header";
1722+
LOG_ERROR << "[LTC] submitblock: hex data too short for a valid block header";
17231723
return {{"error", "block data too short"}};
17241724
}
17251725

@@ -1751,7 +1751,7 @@ nlohmann::json MiningInterface::submitblock(const std::string& hex_data, const s
17511751
uint256 expected_prev;
17521752
expected_prev.SetHex(m_cached_template["previousblockhash"].get<std::string>());
17531753
if (submitted_prev_hash != expected_prev) {
1754-
LOG_WARNING << "submitblock: stale block — prev_hash mismatch"
1754+
LOG_WARNING << "[LTC] submitblock: stale block — prev_hash mismatch"
17551755
<< " submitted=" << submitted_prev_hash.GetHex()
17561756
<< " expected=" << expected_prev.GetHex();
17571757
is_stale = true;
@@ -1760,7 +1760,7 @@ nlohmann::json MiningInterface::submitblock(const std::string& hex_data, const s
17601760

17611761
// Reconstruct expected merkle_root from coinbase + merkle branches
17621762
if (!is_stale && !m_cached_coinb1.empty() && !m_cached_coinb2.empty()) {
1763-
LOG_TRACE << "submitblock: merkle_root=" << submitted_merkle_root.GetHex();
1763+
LOG_TRACE << "[LTC] submitblock: merkle_root=" << submitted_merkle_root.GetHex();
17641764
}
17651765
}
17661766
// Fire stale callback OUTSIDE the lock to avoid deadlock
@@ -1797,13 +1797,13 @@ nlohmann::json MiningInterface::submitblock(const std::string& hex_data, const s
17971797
} else if (m_embedded_node) {
17981798
// Phase 4 embedded mode: no daemon — relay the block directly via P2P.
17991799
// on_block_relay is wired to CoinBroadcaster::submit_block_raw().
1800-
LOG_TRACE << "submitblock: embedded relay " << hex_data.size()/2 << " bytes";
1800+
LOG_TRACE << "[LTC] submitblock: embedded relay " << hex_data.size()/2 << " bytes";
18011801
if (m_on_block_relay)
18021802
m_on_block_relay(hex_data);
18031803
if (m_on_block_submitted && hex_data.size() >= 160)
18041804
m_on_block_submitted(hex_data.substr(0, 160), 0);
18051805
} else {
1806-
LOG_WARNING << "submitblock: no coin RPC or embedded node connected, block discarded";
1806+
LOG_WARNING << "[LTC] submitblock: no coin RPC or embedded node connected, block discarded";
18071807
}
18081808

18091809
return nullptr; // null = accepted in getblocktemplate spec
@@ -3784,7 +3784,7 @@ nlohmann::json MiningInterface::mining_submit(const std::string& username, const
37843784
const std::map<uint32_t, std::vector<unsigned char>>& merged_addresses,
37853785
const JobSnapshot* job)
37863786
{
3787-
LOG_TRACE << "mining.submit " << username << " job=" << job_id
3787+
LOG_TRACE << "[Stratum] mining.submit " << username << " job=" << job_id
37883788
<< " nonce=" << nonce << " en2=" << extranonce2;
37893789

37903790
// Basic share validation
@@ -4765,7 +4765,7 @@ void StratumSession::process_message(std::size_t bytes_read)
47654765
line.pop_back(); // Remove \r if present
47664766
}
47674767

4768-
LOG_TRACE << "Stratum message received: " << line;
4768+
LOG_TRACE << "[Stratum] Received: " << line;
47694769

47704770
auto request = nlohmann::json::parse(line);
47714771
std::string method = request.value("method", "");

src/impl/ltc/coin/p2p_node.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ class NodeP2P : public core::ICommunicator, public core::INetwork, public core::
330330

331331
ADD_P2P_HANDLER(version)
332332
{
333-
LOG_INFO << "version is?: " << msg->m_command
333+
LOG_INFO << "[CoinP2P] version: " << msg->m_command
334334
<< " start_height=" << msg->m_start_height;
335335
// Notify header chain of peer's tip height for fast-sync scrypt skip.
336336
if (m_on_peer_height && msg->m_start_height > 0)

src/pool/node.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ class BaseNode : public NodeInterfaces, public core::Factory<core::Server, core:
9494
peer->m_timeout = std::make_unique<core::Timer>(m_context, true);
9595
peer->m_timeout->start(NEW_PEER_TIMEOUT_TIME, [&, addr = peer->addr()](){ timeout(addr); });
9696

97-
LOG_INFO << socket->get_addr().to_string() << " try to connect!";
97+
LOG_INFO << "[P2Pool] " << socket->get_addr().to_string() << " connected";
9898
}
9999

100100
void error(const message_error_type& err, const NetService& service, const std::source_location where = std::source_location::current()) override
101101
{
102-
LOG_ERROR << "PoolNode <NetName>[" << service.to_string() << "]:";
102+
LOG_ERROR << "[P2Pool] <NetName>[" << service.to_string() << "]:";
103103
LOG_ERROR << "\terror: " << err;
104104
LOG_ERROR << "\twhere: " << where.function_name();
105105
if (m_connections.contains(service))

0 commit comments

Comments
 (0)