@@ -112,6 +112,9 @@ def __init__(self):
112112 # By default the wallet is not required. Set to true by skip_if_no_wallet().
113113 # When False, we ignore wallet_names regardless of what it is.
114114 self .requires_wallet = False
115+ # Disable ThreadOpenConnections by default, so that adding entries to
116+ # addrman will not result in automatic connections to them.
117+ self .disable_autoconnect = True
115118 self .set_test_params ()
116119 assert self .wallet_names is None or len (self .wallet_names ) <= self .num_nodes
117120 if self .options .timeout_factor == 0 :
@@ -711,7 +714,7 @@ def _initialize_chain(self):
711714 if not os .path .isdir (cache_node_dir ):
712715 self .log .debug ("Creating cache directory {}" .format (cache_node_dir ))
713716
714- initialize_datadir (self .options .cachedir , CACHE_NODE_ID , self .chain )
717+ initialize_datadir (self .options .cachedir , CACHE_NODE_ID , self .chain , self . disable_autoconnect )
715718 self .nodes .append (
716719 TestNode (
717720 CACHE_NODE_ID ,
@@ -769,15 +772,15 @@ def cache_path(*paths):
769772 self .log .debug ("Copy cache directory {} to node {}" .format (cache_node_dir , i ))
770773 to_dir = get_datadir_path (self .options .tmpdir , i )
771774 shutil .copytree (cache_node_dir , to_dir )
772- initialize_datadir (self .options .tmpdir , i , self .chain ) # Overwrite port/rpcport in bitcoin.conf
775+ initialize_datadir (self .options .tmpdir , i , self .chain , self . disable_autoconnect ) # Overwrite port/rpcport in bitcoin.conf
773776
774777 def _initialize_chain_clean (self ):
775778 """Initialize empty blockchain for use by the test.
776779
777780 Create an empty blockchain and num_nodes wallets.
778781 Useful if a test case wants complete control over initialization."""
779782 for i in range (self .num_nodes ):
780- initialize_datadir (self .options .tmpdir , i , self .chain )
783+ initialize_datadir (self .options .tmpdir , i , self .chain , self . disable_autoconnect )
781784
782785 def skip_if_no_py3_zmq (self ):
783786 """Attempt to import the zmq package and skip the test if the import fails."""
0 commit comments