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

Function test_disconnect_fundee

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

Source from the content-addressed store, hash-verified

538@pytest.mark.openchannel('v1')
539@pytest.mark.openchannel('v2')
540def test_disconnect_fundee(node_factory):
541 # Now error on fundee side during channel open.
542 disconnects = ['-WIRE_ACCEPT_CHANNEL',
543 '+WIRE_ACCEPT_CHANNEL']
544 if EXPERIMENTAL_DUAL_FUND:
545 disconnects = ['-WIRE_ACCEPT_CHANNEL2',
546 '+WIRE_ACCEPT_CHANNEL2',
547 '-WIRE_TX_COMPLETE',
548 '+WIRE_TX_COMPLETE']
549
550 l1 = node_factory.get_node()
551 l2 = node_factory.get_node(disconnect=disconnects)
552
553 l1.fundwallet(2000000)
554
555 for d in disconnects:
556 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
557 with pytest.raises(RpcError):
558 l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE)
559 # First peer valishes, but later it just disconnects
560 wait_for(lambda: all([p['connected'] is False for p in l1.rpc.listpeers()['peers']]))
561
562 # This one will succeed.
563 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
564 l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE)
565
566 # Should still only have one peer!
567 assert len(l1.rpc.listpeers()) == 1
568 assert len(l2.rpc.listpeers()) == 1
569
570
571@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')

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