@@ -2335,12 +2335,20 @@ def test_gossip_seeker_autoconnect(node_factory):
23352335 necessary."""
23362336
23372337 port = node_factory .get_unused_port ()
2338- opts = [{}, {}, {'bind-addr' : f'127.0.0.1:{ port } ' ,
2339- 'announce-addr' : f'127.0.0.1:{ port } ' }]
2340- # l1, l2 = node_factory.get_nodes(2)
2338+ opts = [{'autoconnect-seeker-peers' : 0 , 'may_reconnect' : True },
2339+ {'may_reconnect' : True },
2340+ {'bind-addr' : f'127.0.0.1:{ port } ' ,
2341+ 'announce-addr' : f'127.0.0.1:{ port } ' }]
23412342 l1 , l2 , l3 = node_factory .line_graph (3 , opts = opts , wait_for_announce = True )
2342- # L1 and L3 should autoconnect with valid node announcement connection addresses
2343- # Wait for seeker to decide to autoconnect
2343+ l2 .daemon .wait_for_log ('gossipd: seeker: need more peers for gossip' )
2344+ time .sleep (1 )
2345+ # The seeker wants more peers, but l1 should not autoconnect due to option.
2346+ assert not l1 .daemon .is_in_log (r'lightningd: attempting connection to ' )
2347+
2348+ # Try again with default settings.
2349+ del l1 .daemon .opts ['autoconnect-seeker-peers' ]
2350+ l1 .restart ()
2351+ # L1 and L3 should autoconnect with valid node announcement connection addresses.
23442352 l1 .daemon .wait_for_log ('gossipd: seeker: need more peers for gossip' )
23452353 l1 .daemon .wait_for_log (r'lightningd: attempting connection to '
23462354 rf'{ l3 .info ["id" ]} for additional gossip' )
0 commit comments