File tree Expand file tree Collapse file tree 4 files changed +40
-3
lines changed Expand file tree Collapse file tree 4 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -435,7 +435,8 @@ class CRegTestParams : public CChainParams {
435
435
assert (genesis.hashMerkleRoot == uint256S (" 0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" ));
436
436
437
437
vFixedSeeds.clear (); // !< Regtest mode doesn't have any fixed seeds.
438
- vSeeds.clear (); // !< Regtest mode doesn't have any DNS seeds.
438
+ vSeeds.clear ();
439
+ vSeeds.emplace_back (" dummySeed.invalid." );
439
440
440
441
fDefaultConsistencyChecks = true ;
441
442
fRequireStandard = true ;
Original file line number Diff line number Diff line change @@ -158,8 +158,9 @@ def test_seed_peers(self):
158
158
self .stop_node (0 )
159
159
160
160
# No peers.dat exists and -dnsseed=1
161
- # We expect the node will use DNS Seeds, but Regtest mode has 0 DNS seeds
162
- # So after 60 seconds, the node should fallback to fixed seeds (this is a slow test)
161
+ # We expect the node will use DNS Seeds, but Regtest mode does not have
162
+ # any valid DNS seeds. So after 60 seconds, the node should fallback to
163
+ # fixed seeds
163
164
assert not os .path .exists (os .path .join (default_data_dir , "peers.dat" ))
164
165
start = int (time .time ())
165
166
with self .nodes [0 ].assert_debug_log (expected_msgs = [
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2021 The Bitcoin Core developers
3
+ # Distributed under the MIT software license, see the accompanying
4
+ # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
+ """Test ThreadDNSAddressSeed logic for querying DNS seeds."""
6
+
7
+ from test_framework .p2p import P2PInterface
8
+ from test_framework .test_framework import BitcoinTestFramework
9
+
10
+
11
+ class P2PDNSSeeds (BitcoinTestFramework ):
12
+ def set_test_params (self ):
13
+ self .setup_clean_chain = True
14
+ self .num_nodes = 1
15
+ self .extra_args = [["-dnsseed=1" ]]
16
+
17
+ def run_test (self ):
18
+ self .existing_outbound_connections_test ()
19
+
20
+ def existing_outbound_connections_test (self ):
21
+ # Make sure addrman is populated to enter the conditional where we
22
+ # delay and potentially skip DNS seeding.
23
+ self .nodes [0 ].addpeeraddress ("192.0.0.8" , 8333 )
24
+
25
+ self .log .info ("Check that we *do not* query DNS seeds if we have 2 outbound connections" )
26
+
27
+ self .restart_node (0 )
28
+ with self .nodes [0 ].assert_debug_log (expected_msgs = ["P2P peers available. Skipped DNS seeding." ], timeout = 12 ):
29
+ for i in range (2 ):
30
+ self .nodes [0 ].add_outbound_p2p_connection (P2PInterface (), p2p_idx = i , connection_type = "outbound-full-relay" )
31
+
32
+
33
+ if __name__ == '__main__' :
34
+ P2PDNSSeeds ().main ()
Original file line number Diff line number Diff line change 121
121
'wallet_listreceivedby.py --legacy-wallet' ,
122
122
'wallet_listreceivedby.py --descriptors' ,
123
123
'wallet_abandonconflict.py --legacy-wallet' ,
124
+ 'p2p_dns_seeds.py' ,
124
125
'wallet_abandonconflict.py --descriptors' ,
125
126
'feature_csv_activation.py' ,
126
127
'rpc_rawtransaction.py --legacy-wallet' ,
You can’t perform that action at this time.
0 commit comments