pytest: wait_channel_quiescent helper to wait for resolved htlcs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-09-27 15:03:27 +09:30 committed by Christian Decker
parent 9fa7f5e30e
commit a90c200fcb
1 changed files with 5 additions and 0 deletions

View File

@ -70,6 +70,11 @@ def sync_blockheight(bitcoind, nodes):
wait_for(lambda: n.rpc.getinfo()['blockheight'] == height)
def wait_channel_quiescent(n1, n2):
wait_for(lambda: only_one(only_one(n1.rpc.listpeers(n2.info['id'])['peers'])['channels'])['htlcs'] == [])
wait_for(lambda: only_one(only_one(n2.rpc.listpeers(n1.info['id'])['peers'])['channels'])['htlcs'] == [])
class TailableProc(object):
"""A monitorable process that we can start, stop and tail.