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

Function test_disconnect

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

Source from the content-addressed store, hash-verified

460@pytest.mark.openchannel('v1')
461@pytest.mark.openchannel('v2')
462def test_disconnect(node_factory):
463 # These should all make us fail
464 disconnects = ['-WIRE_INIT',
465 '+WIRE_INIT']
466 l1 = node_factory.get_node(disconnect=disconnects)
467 l2 = node_factory.get_node()
468
469 with pytest.raises(RpcError):
470 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
471 with pytest.raises(RpcError):
472 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
473
474 # Should have 3 connect fails.
475 for d in disconnects:
476 l1.daemon.wait_for_log('{}-.*Failed connected out'
477 .format(l2.info['id']))
478
479 # Should still only have one peer!
480 assert len(l1.rpc.listpeers()) == 1
481 assert len(l2.rpc.listpeers()) == 1
482
483
484@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 4

wait_for_logMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected