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

Function test_disconnect_fundee

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

Source from the content-addressed store, hash-verified

490@pytest.mark.openchannel('v1')
491@pytest.mark.openchannel('v2')
492def test_disconnect_fundee(node_factory):
493 # Now error on fundee side during channel open.
494 disconnects = ['-WIRE_ACCEPT_CHANNEL',
495 '+WIRE_ACCEPT_CHANNEL']
496 if EXPERIMENTAL_DUAL_FUND:
497 disconnects = ['-WIRE_ACCEPT_CHANNEL2',
498 '+WIRE_ACCEPT_CHANNEL2',
499 '-WIRE_TX_COMPLETE',
500 '+WIRE_TX_COMPLETE']
501
502 l1 = node_factory.get_node()
503 l2 = node_factory.get_node(disconnect=disconnects)
504
505 l1.fundwallet(2000000)
506
507 for d in disconnects:
508 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
509 with pytest.raises(RpcError):
510 l1.rpc.fundchannel(l2.info['id'], 25000)
511 # First peer valishes, but later it just disconnects
512 wait_for(lambda: all([p['connected'] is False for p in l1.rpc.listpeers()['peers']]))
513
514 # This one will succeed.
515 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
516 l1.rpc.fundchannel(l2.info['id'], 25000)
517
518 # Should still only have one peer!
519 assert len(l1.rpc.listpeers()) == 1
520 assert len(l2.rpc.listpeers()) == 1
521
522
523@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