Skip to content
Bitcoin Roots

v29.4-roots.2 · Commit 3: [PATCH 03/21] policy: restore conservative relay and network controls

src/test/net_peer_connection_tests.cpp

Before: src/test/net_peer_connection_tests.cpp · After: src/test/net_peer_connection_tests.cpp

File metadata
index e60ce8b99d36008bd4fd70ccd4fd1bbf38319d61..d9ddeb8e1fa2851420f282a49177dae148d7c8c0 100644

Download original patch · Release notes

Diff rows 1–24 of 24. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/test/net_peer_connection_tests.cpp CHANGED
@@ -72,7 +72,8 @@ void AddPeer(NodeId& id, std::vector<CNode*>& nodes, PeerManager& peerman, Connm
72
72
  CAddress{},
73
73
  /*addrNameIn=*/"",
74
74
  conn_type,
75
- /*inbound_onion=*/inbound_onion});
75
+ /*inbound_onion=*/inbound_onion,
76
+ /*network_key=*/0});
76
77
  CNode& node = *nodes.back();
77
78
  node.SetCommonVersion(PROTOCOL_VERSION);
78
79
 
@@ -129,6 +130,15 @@ BOOST_FIXTURE_TEST_CASE(test_addnode_getaddednodeinfo_and_connection_detection,
129
130
  BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"127.1", /*m_use_v2transport=*/true}));
130
131
  #endif
131
132
 
133
+ BOOST_TEST_MESSAGE("\nCall AddNode() with a CJDNS service equal to an existing addnode entry; it should not be added");
134
+ BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"[fc00:3344:5566:7788:9900:aabb:ccdd:eeff]:1234", /*m_use_v2transport=*/false}));
135
+
136
+ BOOST_TEST_MESSAGE("\nCall AddNode() with a CJDNS addr equal to an existing inbound one but with a different port specified; it should not be added");
137
+ BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"[fc00:3344:5566:7788:9900:aabb:ccdd:eeff]:8333", /*m_use_v2transport=*/false}));
138
+
139
+ BOOST_TEST_MESSAGE("\nCall AddNode() with a CJDNS addr equal to an existing inbound one but resolving to a different port; it should not be added");
140
+ BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"fc00:3344:5566:7788:9900:aabb:ccdd:eeff", /*m_use_v2transport=*/false}));
141
+
132
142
  BOOST_TEST_MESSAGE("\nExpect GetAddedNodeInfo to return expected number of peers with `include_connected` true/false");
133
143
  BOOST_CHECK_EQUAL(connman->GetAddedNodeInfo(/*include_connected=*/true).size(), nodes.size());
134
144
  BOOST_CHECK(connman->GetAddedNodeInfo(/*include_connected=*/false).empty());