Skip to content

Commit

Permalink
pytest: make sure connection settles after dev_disconnect in test_mul…
Browse files Browse the repository at this point in the history
…tifunding_v2_best_effort

```
@pytest.mark.openchannel('v1')
@pytest.mark.developer("disconnect=... needs DEVELOPER=1")
deftest_multifunding_best_effort(node_factory, bitcoind):
'''
    Check that best_effort flag works.
    '''
        disconnects = ["-WIRE_INIT",
"-WIRE_ACCEPT_CHANNEL",
"-WIRE_FUNDING_SIGNED"]
        l1 = node_factory.get_node()
        l2 = node_factory.get_node()
        l3 = node_factory.get_node(disconnect=disconnects)
        l4 = node_factory.get_node()
        l1.fundwallet(2000000)
        destinations = [{"id": '{}@localhost:{}'.format(l2.info['id'], l2.port),
"amount": 50000},
                        {"id": '{}@localhost:{}'.format(l3.info['id'], l3.port),
"amount": 50000},
                        {"id": '{}@localhost:{}'.format(l4.info['id'], l4.port),
"amount": 50000}]
for i, d inenumerate(disconnects):
# Should succeed due to best-effort flag.
>           l1.rpc.multifundchannel(destinations, minchannels=2)
tests/test_connection.py:2095: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
...
>           raise RpcError(method, payload, resp['error'])
E           pyln.client.lightning.RpcError: RPC call failed: method: multifundchannel, payload: {'destinations': [{'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59@localhost:34189', 'amount': 50000}, {'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d@localhost:44003', 'amount': 50000}, {'id': '0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199@localhost:38949', 'amount': 50000}], 'minchannels': 2}, error: {'code': -1, 'message': 'Owning subdaemon openingd died (62208)', 'data': {'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d', 'method': 'fundchannel_complete'}}
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Jul 14, 2022
1 parent f32d27b commit 45cd886
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def get_funded_channel_scid(n1, n2):
for node in node_list:
node.daemon.wait_for_log(r'to CLOSINGD_COMPLETE')

# Make sure disconnections are complete
if not failed_sign:
wait_for(lambda: all([c['connected'] is False for c in l1.rpc.listpeers()['peers']]))

# With 2 down, it will fail to fund channel
l2.stop()
l3.stop()
Expand Down

0 comments on commit 45cd886

Please sign in to comment.