From f1b142856a4ecd0a0d90bc3d73ef5137997b14ff Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Thu, 24 Apr 2025 16:32:42 -0700 Subject: [PATCH] test: Same addr, diff port is already connected --- src/test/net_peer_connection_tests.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/net_peer_connection_tests.cpp b/src/test/net_peer_connection_tests.cpp index e60ce8b99d3..ba3224bca9d 100644 --- a/src/test/net_peer_connection_tests.cpp +++ b/src/test/net_peer_connection_tests.cpp @@ -155,6 +155,13 @@ BOOST_FIXTURE_TEST_CASE(test_addnode_getaddednodeinfo_and_connection_detection, BOOST_CHECK(connman->AlreadyConnectedPublic(node->addr)); } + BOOST_TEST_MESSAGE("\nCheck that peers with the same addresses as connected peers but different ports are detected as connected."); + for (auto node : connman->TestNodes()) { + uint16_t changed_port = node->addr.GetPort() + 1; + CService address_with_changed_port{node->addr, changed_port}; + BOOST_CHECK(connman->AlreadyConnectedPublic(CAddress{address_with_changed_port, NODE_NONE})); + } + // Clean up for (auto node : connman->TestNodes()) { peerman->FinalizeNode(*node);