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

Function test_ping_timeout

tests/test_connection.py:4044–4064  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

4042
4043
4044def test_ping_timeout(node_factory):
4045 # Disconnects after this, but doesn't know it.
4046 l1_disconnects = ['xWIRE_PING']
4047
4048 # We remove the gossip_queries feature: otherwise the peer can try to do
4049 # a gossip sync, and so we never get the period of no-traffic required to
4050 # trigger a ping!
4051 l1, l2 = node_factory.get_nodes(2, opts=[{'dev-no-reconnect': None,
4052 'dev-force-features': -7,
4053 'disconnect': l1_disconnects},
4054 {'dev-no-ping-timer': None,
4055 'dev-force-features': -7}])
4056 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
4057
4058 # Ping timers runs at 15-45 seconds, *but* only fires if also 60 seconds
4059 # after previous traffic.
4060 l1.daemon.wait_for_log('dev_disconnect: xWIRE_PING', timeout=60 + 45 + 5)
4061
4062 # Next pign will cause hangup
4063 l1.daemon.wait_for_log('Last ping unreturned: hanging up', timeout=45 + 5)
4064 wait_for(lambda: l1.rpc.listpeers(l2.info['id'])['peers'] == [])
4065
4066
4067@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 5

wait_forFunction · 0.90
get_nodesMethod · 0.80
wait_for_logMethod · 0.80
connectMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected