Skip to content

Commit f1b1428

Browse files
davidgumbergvasild
authored andcommitted
test: Same addr, diff port is already connected
1 parent 94e85a8 commit f1b1428

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/net_peer_connection_tests.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ BOOST_FIXTURE_TEST_CASE(test_addnode_getaddednodeinfo_and_connection_detection,
155155
BOOST_CHECK(connman->AlreadyConnectedPublic(node->addr));
156156
}
157157

158+
BOOST_TEST_MESSAGE("\nCheck that peers with the same addresses as connected peers but different ports are detected as connected.");
159+
for (auto node : connman->TestNodes()) {
160+
uint16_t changed_port = node->addr.GetPort() + 1;
161+
CService address_with_changed_port{node->addr, changed_port};
162+
BOOST_CHECK(connman->AlreadyConnectedPublic(CAddress{address_with_changed_port, NODE_NONE}));
163+
}
164+
158165
// Clean up
159166
for (auto node : connman->TestNodes()) {
160167
peerman->FinalizeNode(*node);

0 commit comments

Comments
 (0)