mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
pytest: make sure receiving peer's openingd is ready.
There's now a potential race: the source peer connect returns, but in destination peer the master hasn't read the connect message from connectd, so the peer isn't in listpeers yet. (Previously the connection stayed in connectd, so there was no such window). This is an occasional issue in a few places. Note that we take the opportunity to speed up test_disconnectpeer too while we're there. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
50f5eb34b4
commit
e59cbb3e2c
@@ -988,15 +988,14 @@ def test_disconnectpeer(node_factory, bitcoind):
|
||||
assert len(l1.rpc.getpeer(l2.info['id'])['channels']) == 0
|
||||
assert l1.rpc.getpeer(l3.info['id'])['connected']
|
||||
assert len(l1.rpc.getpeer(l3.info['id'])['channels']) == 0
|
||||
wait_for(lambda: l2.rpc.getpeer(l1.info['id']) is not None)
|
||||
|
||||
# Disconnect l2 from l1
|
||||
l1.rpc.disconnect(l2.info['id'])
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
# Make sure listpeers no longer returns the disconnected node
|
||||
assert l1.rpc.getpeer(l2.info['id']) is None
|
||||
assert l2.rpc.getpeer(l1.info['id']) is None
|
||||
wait_for(lambda: l2.rpc.getpeer(l1.info['id']) is None)
|
||||
|
||||
# Make sure you cannot disconnect after disconnecting
|
||||
with pytest.raises(RpcError, match=r'Peer not connected'):
|
||||
|
||||
Reference in New Issue
Block a user