net_processing: use CNode::DisconnectMsg helper

This is not a pure refactor:
1. It slightly changes the log messages, as reflected in the test changes
2. It adds the IP address to all disconnect logging (when fLogIPs is set)
This commit is contained in:
Sjors Provoost
2024-07-23 12:35:59 +02:00
parent ad224429f8
commit 937ef9eb40
5 changed files with 53 additions and 50 deletions

View File

@ -172,7 +172,7 @@ class P2PLeakTest(BitcoinTestFramework):
self.log.info('Check that old peers are disconnected')
p2p_old_peer = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
with self.nodes[0].assert_debug_log(["using obsolete version 31799; disconnecting"]):
with self.nodes[0].assert_debug_log(["using obsolete version 31799, disconnecting peer=5"]):
p2p_old_peer.send_message(self.create_old_version(31799))
p2p_old_peer.wait_for_disconnect()