diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2021-05-28 13:49:29 -0700 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2021-07-30 11:15:49 -0700 |
commit | 75c05af361552eeecd100cee8cc40d4cd5a3aa27 (patch) | |
tree | c13807384da0378eb2f928a3f741fdf5d29e9c26 /test/functional/p2p_dns_seeds.py | |
parent | 9c0871977839c28636eff975748182888299cd2b (diff) | |
download | bitcoin-75c05af361552eeecd100cee8cc40d4cd5a3aa27.tar.xz |
[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 <mzumsande@gmail.com>
Diffstat (limited to 'test/functional/p2p_dns_seeds.py')
-rwxr-xr-x | test/functional/p2p_dns_seeds.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/p2p_dns_seeds.py b/test/functional/p2p_dns_seeds.py index 254f9af445..b58607a5c9 100755 --- a/test/functional/p2p_dns_seeds.py +++ b/test/functional/p2p_dns_seeds.py @@ -16,6 +16,7 @@ class P2PDNSSeeds(BitcoinTestFramework): def run_test(self): self.existing_outbound_connections_test() + self.existing_block_relay_connections_test() def existing_outbound_connections_test(self): # Make sure addrman is populated to enter the conditional where we @@ -29,6 +30,23 @@ class P2PDNSSeeds(BitcoinTestFramework): for i in range(2): self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=i, connection_type="outbound-full-relay") + def existing_block_relay_connections_test(self): + # Make sure addrman is populated to enter the conditional where we + # delay and potentially skip DNS seeding. No-op when run after + # existing_outbound_connections_test. + self.nodes[0].addpeeraddress("192.0.0.8", 8333) + + self.log.info("Check that we *do* query DNS seeds if we only have 2 block-relay-only connections") + + self.restart_node(0) + with self.nodes[0].assert_debug_log(expected_msgs=["Loading addresses from DNS seed"], timeout=12): + # This mimics the "anchors" logic where nodes are likely to + # reconnect to block-relay-only connections on startup. + # Since we do not participate in addr relay with these connections, + # we still want to query the DNS seeds. + for i in range(2): + self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=i, connection_type="block-relay-only") + if __name__ == '__main__': P2PDNSSeeds().main() |