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

Function test_disconnect_opener

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

Source from the content-addressed store, hash-verified

486# FIXME: https://github.com/ElementsProject/lightning/issues/8822
487@pytest.mark.flaky(reruns=1)
488def test_disconnect_opener(node_factory):
489 # Now error on opener side during channel open.
490 disconnects = ['-WIRE_OPEN_CHANNEL',
491 '+WIRE_OPEN_CHANNEL',
492 '-WIRE_FUNDING_CREATED']
493 if EXPERIMENTAL_DUAL_FUND:
494 disconnects = ['-WIRE_OPEN_CHANNEL2',
495 '+WIRE_OPEN_CHANNEL2',
496 '-WIRE_TX_ADD_INPUT',
497 '+WIRE_TX_ADD_INPUT',
498 '-WIRE_TX_ADD_OUTPUT',
499 '+WIRE_TX_ADD_OUTPUT',
500 '-WIRE_TX_COMPLETE',
501 '=WIRE_TX_COMPLETE']
502
503 l1 = node_factory.get_node(disconnect=disconnects,
504 may_reconnect=EXPERIMENTAL_DUAL_FUND,
505 options={'dev-no-reconnect': None})
506 l2 = node_factory.get_node(may_reconnect=EXPERIMENTAL_DUAL_FUND,
507 options={'dev-no-reconnect': None})
508
509 l1.fundwallet(2000000)
510
511 for d in disconnects:
512 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
513 with pytest.raises(RpcError):
514 l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE)
515 # First peer valishes, but later it just disconnects
516 wait_for(lambda: all([p['connected'] is False for p in l1.rpc.listpeers()['peers']]))
517
518 # This one will succeed.
519 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
520 l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE)
521
522 # Should still only have one peer!
523 assert len(l1.rpc.listpeers()['peers']) == 1
524 assert len(l2.rpc.listpeers()['peers']) == 1
525
526
527def 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