MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_seeker_first_peer

Function test_seeker_first_peer

tests/test_gossip.py:2399–2427  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2397
2398
2399def test_seeker_first_peer(node_factory, bitcoind):
2400 l1, l2, l3, l4, l5 = node_factory.get_nodes(5)
2401
2402 node_factory.join_nodes([l4, l5], wait_for_announce=True)
2403
2404 # We always ask peer for everything if we have no gossip.
2405 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2406 l1.daemon.wait_for_log(rf"{l2.info['id']}-gossipd: seeker: starting gossip \(EVERYTHING\)")
2407
2408 # Still no gossip, so we ask second peer too.
2409 l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
2410 l1.daemon.wait_for_log(rf"{l3.info['id']}-gossipd: seeker: starting gossip \(EVERYTHING\)")
2411
2412 # We can actually get gossip *before* we kick seeker, so it may stream here!
2413 l1.rpc.connect(l4.info['id'], 'localhost', l4.port)
2414 wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 2)
2415
2416 l1.rpc.connect(l5.info['id'], 'localhost', l5.port)
2417 l1.daemon.wait_for_log(rf"{l5.info['id']}-gossipd: seeker: starting gossip \(streaming\)")
2418
2419 # Now we restart, and we'll ask the first peer, even though we have gossip.
2420 l1.restart()
2421
2422 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2423 l1.daemon.wait_for_log(rf"{l2.info['id']}-gossipd: seeker: starting gossip \(EVERYTHING\)")
2424 l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
2425 # This can take more than 10 seconds, so we add to timeout here!
2426 l1.daemon.wait_for_log(rf"{l3.info['id']}-gossipd: seeker: starting gossip \(streaming\)",
2427 timeout=TIMEOUT + 10)
2428
2429
2430def test_gossip_force_broadcast_channel_msgs(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 7

wait_forFunction · 0.90
get_nodesMethod · 0.80
join_nodesMethod · 0.80
wait_for_logMethod · 0.80
restartMethod · 0.80
connectMethod · 0.45
listchannelsMethod · 0.45

Tested by

no test coverage detected