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

Function test_disconnect_opener

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

Source from the content-addressed store, hash-verified

440@pytest.mark.openchannel('v1')
441@pytest.mark.openchannel('v2')
442def test_disconnect_opener(node_factory):
443 # Now error on opener side during channel open.
444 disconnects = ['-WIRE_OPEN_CHANNEL',
445 '+WIRE_OPEN_CHANNEL',
446 '-WIRE_FUNDING_CREATED']
447 if EXPERIMENTAL_DUAL_FUND:
448 disconnects = ['-WIRE_OPEN_CHANNEL2',
449 '+WIRE_OPEN_CHANNEL2',
450 '-WIRE_TX_ADD_INPUT',
451 '+WIRE_TX_ADD_INPUT',
452 '-WIRE_TX_ADD_OUTPUT',
453 '+WIRE_TX_ADD_OUTPUT',
454 '-WIRE_TX_COMPLETE',
455 '+WIRE_TX_COMPLETE']
456
457 l1 = node_factory.get_node(disconnect=disconnects)
458 l2 = node_factory.get_node(may_reconnect=EXPERIMENTAL_DUAL_FUND)
459
460 l1.fundwallet(2000000)
461
462 for d in disconnects:
463 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
464 with pytest.raises(RpcError):
465 l1.rpc.fundchannel(l2.info['id'], 25000)
466 # First peer valishes, but later it just disconnects
467 wait_for(lambda: all([p['connected'] is False for p in l1.rpc.listpeers()['peers']]))
468
469 # This one will succeed.
470 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
471 l1.rpc.fundchannel(l2.info['id'], 25000)
472
473 # Should still only have one peer!
474 assert len(l1.rpc.listpeers()['peers']) == 1
475 assert len(l2.rpc.listpeers()['peers']) == 1
476
477
478def test_remote_disconnect(node_factory):

Callers

nothing calls this directly

Calls 6

wait_forFunction · 0.90
fundwalletMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected