mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-10 01:24:30 +01:00
pytest: fix flaky test if one side hasn't processed close yet.
```
@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
def test_funding_close_upfront(node_factory, bitcoind):
...
# check that you can provide a closing address upfront
addr = l1.rpc.newaddr()['bech32']
> _fundchannel(l1, l2, amt_normal, addr)
...
pyln.client.lightning.RpcError: RPC call failed: method: fundchannel_start, payload: {'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'amount': 100000, 'announce': True, 'close_to': 'bcrt1qctx2k9cu9fd7nk449mzphqjcvvpyc4rxh6826x'}, error: {'code': -1, 'message': 'They sent error channel 2a1ca624cd1127761cb7a4395df2c3fd6d0abb3732c1f85a5345b0da716540d0: Multiple channels unsupported'}
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
ad049c36c1
commit
79a21755c4
@@ -1080,10 +1080,19 @@ def test_funding_close_upfront(node_factory, bitcoind):
|
||||
|
||||
remote_valid_addr = 'bcrt1q7gtnxmlaly9vklvmfj06amfdef3rtnrdazdsvw'
|
||||
|
||||
def has_normal_channels(l1, l2):
|
||||
return any([c['state'] == 'CHANNELD_AWAITING_LOCKIN'
|
||||
or c['state'] == 'CHANNELD_NORMAL'
|
||||
for c in only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels']])
|
||||
|
||||
def _fundchannel(l1, l2, amount, close_to):
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||
assert(l1.rpc.listpeers()['peers'][0]['id'] == l2.info['id'])
|
||||
|
||||
# Make sure both consider any previous channels closed.
|
||||
wait_for(lambda: not has_normal_channels(l1, l2))
|
||||
wait_for(lambda: not has_normal_channels(l2, l1))
|
||||
|
||||
resp = l1.rpc.fundchannel_start(l2.info['id'], amount, close_to=close_to)
|
||||
address = resp['funding_address']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user