Skip to content

Commit 0c4954a

Browse files
committed
net_processing: Add missing use of DisconnectMsg
Makes it easier to grep logs for "disconnecting" when investigating disconnections.
1 parent 37af8bf commit 0c4954a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4205,7 +4205,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
42054205

42064206
if (msg_type == NetMsgType::TX) {
42074207
if (RejectIncomingTxs(pfrom)) {
4208-
LogDebug(BCLog::NET, "transaction sent in violation of protocol peer=%d\n", pfrom.GetId());
4208+
LogDebug(BCLog::NET, "transaction sent in violation of protocol, %s", pfrom.DisconnectMsg(fLogIPs));
42094209
pfrom.fDisconnect = true;
42104210
return;
42114211
}
@@ -5207,7 +5207,7 @@ void PeerManagerImpl::MaybeSendPing(CNode& node_to, Peer& peer, std::chrono::mic
52075207
{
52085208
// The ping timeout is using mocktime. To disable the check during
52095209
// testing, increase -peertimeout.
5210-
LogDebug(BCLog::NET, "ping timeout: %fs peer=%d\n", 0.000001 * count_microseconds(now - peer.m_ping_start.load()), peer.m_id);
5210+
LogDebug(BCLog::NET, "ping timeout: %fs, %s", 0.000001 * count_microseconds(now - peer.m_ping_start.load()), node_to.DisconnectMsg(fLogIPs));
52115211
node_to.fDisconnect = true;
52125212
return;
52135213
}

test/functional/p2p_blocksonly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def check_p2p_tx_violation(self):
115115
self.log.info('Check that txs from P2P are rejected and result in disconnect')
116116
spendtx = self.miniwallet.create_self_transfer()
117117

118-
with self.nodes[0].assert_debug_log(['transaction sent in violation of protocol peer=0']):
118+
with self.nodes[0].assert_debug_log(['transaction sent in violation of protocol, disconnecting peer=0']):
119119
self.nodes[0].p2ps[0].send_message(msg_tx(spendtx['tx']))
120120
self.nodes[0].p2ps[0].wait_for_disconnect()
121121
assert_equal(self.nodes[0].getmempoolinfo()['size'], 0)

0 commit comments

Comments
 (0)