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

Function test_openchannel_init_alternate

tests/test_connection.py:3814–3839  ·  view source on GitHub ↗

Test to see what happens if two nodes start channeling to each other alternately.

(node_factory, executor)

Source from the content-addressed store, hash-verified

3812
3813@pytest.mark.openchannel('v2')
3814def test_openchannel_init_alternate(node_factory, executor):
3815 ''' Test to see what happens if two nodes start channeling to
3816 each other alternately.
3817 '''
3818 l1, l2 = node_factory.get_nodes(2)
3819
3820 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
3821
3822 l1.fundwallet(2000000)
3823 l2.fundwallet(2000000)
3824
3825 psbt1 = l1.rpc.fundpsbt('1000000msat', '253perkw', 250)['psbt']
3826 psbt2 = l2.rpc.fundpsbt('1000000msat', '253perkw', 250)['psbt']
3827 init = l1.rpc.openchannel_init(l2.info['id'], 100000, psbt1)
3828
3829 fut = executor.submit(l2.rpc.openchannel_init, l1.info['id'], '1000000msat', psbt2)
3830 with pytest.raises(RpcError):
3831 fut.result(10)
3832
3833 # FIXME: Clean up so it doesn't hang. Ok if these fail.
3834 for node in [l1, l2]:
3835 try:
3836 node.rpc.openchannel_abort(init['channel_id'])
3837 except RpcError:
3838 # Ignoring all errors
3839 print("nothing to do")
3840
3841
3842def test_quiescence(node_factory, executor):

Callers

nothing calls this directly

Calls 6

get_nodesMethod · 0.80
fundwalletMethod · 0.80
fundpsbtMethod · 0.80
openchannel_initMethod · 0.80
openchannel_abortMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected