mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-04 05:34:22 +01:00
Sometimes, we haven't reconnected, and so the peer does not exist at all after
the channel is forgotten:
```
2022-09-22T22:49:59.3985374Z # Now, 100 blocks it should be done.
2022-09-22T22:49:59.3985656Z bitcoind.generate_block(100)
2022-09-22T22:49:59.3986112Z > wait_for(lambda: only_one(l1.rpc.listpeers()['peers'])['channels'] == [])
2022-09-22T22:49:59.3986338Z
2022-09-22T22:49:59.3986523Z tests/test_closing.py:2715:
2022-09-22T22:49:59.3986810Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-09-22T22:49:59.3987241Z contrib/pyln-testing/pyln/testing/utils.py:90: in wait_for
2022-09-22T22:49:59.3987568Z while not success():
2022-09-22T22:49:59.3987917Z tests/test_closing.py:2715: in <lambda>
2022-09-22T22:49:59.3988389Z wait_for(lambda: only_one(l1.rpc.listpeers()['peers'])['channels'] == [])
2022-09-22T22:49:59.3988737Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-09-22T22:49:59.3988908Z
2022-09-22T22:49:59.3988979Z arr = []
2022-09-22T22:49:59.3989106Z
2022-09-22T22:49:59.3989209Z def only_one(arr):
2022-09-22T22:49:59.3989545Z """Many JSON RPC calls return an array; often we only expect a single entry
2022-09-22T22:49:59.3989849Z """
2022-09-22T22:49:59.3990063Z > assert len(arr) == 1
2022-09-22T22:49:59.3990388Z E AssertionError
```
You can see it's empty from the call here:
```
2022-09-22T22:49:59.6697941Z DEBUG:root:{
2022-09-22T22:49:59.6698106Z "id": "-c:listpeers#42",
2022-09-22T22:49:59.6698179Z "result": {
2022-09-22T22:49:59.6698270Z "peers": []
2022-09-22T22:49:59.6698346Z }
2022-09-22T22:49:59.6698422Z }
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>