Skip to content

Commit 75c05af

Browse files
[test] Test logic to query DNS seeds with block-relay-only connections
When a node is able to properly shutdown, it will persist its block-relay-only connections to the addrman. On startup, it will attempt to reconnect to these anchors. Since block-relay-only connections do not participate in ADDR relay, succesful connections are insufficient to skip querying the DNS seeds. This test fails prior to the changes in #22013. Co-authored-by: Martin Zumsande <[email protected]>
1 parent 9c08719 commit 75c05af

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/functional/p2p_dns_seeds.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def set_test_params(self):
1616

1717
def run_test(self):
1818
self.existing_outbound_connections_test()
19+
self.existing_block_relay_connections_test()
1920

2021
def existing_outbound_connections_test(self):
2122
# Make sure addrman is populated to enter the conditional where we
@@ -29,6 +30,23 @@ def existing_outbound_connections_test(self):
2930
for i in range(2):
3031
self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=i, connection_type="outbound-full-relay")
3132

33+
def existing_block_relay_connections_test(self):
34+
# Make sure addrman is populated to enter the conditional where we
35+
# delay and potentially skip DNS seeding. No-op when run after
36+
# existing_outbound_connections_test.
37+
self.nodes[0].addpeeraddress("192.0.0.8", 8333)
38+
39+
self.log.info("Check that we *do* query DNS seeds if we only have 2 block-relay-only connections")
40+
41+
self.restart_node(0)
42+
with self.nodes[0].assert_debug_log(expected_msgs=["Loading addresses from DNS seed"], timeout=12):
43+
# This mimics the "anchors" logic where nodes are likely to
44+
# reconnect to block-relay-only connections on startup.
45+
# Since we do not participate in addr relay with these connections,
46+
# we still want to query the DNS seeds.
47+
for i in range(2):
48+
self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=i, connection_type="block-relay-only")
49+
3250

3351
if __name__ == '__main__':
3452
P2PDNSSeeds().main()

0 commit comments

Comments
 (0)