From c8198d98201b5a6291e657b17ac76d6f28f68987 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Wed, 3 Feb 2021 12:21:36 +0100 Subject: [PATCH] pyln-testing: add `scids` param to `wait_for_htlcs` --- contrib/pyln-testing/pyln/testing/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index 40fa38cf7..cdd1ea9de 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -943,11 +943,14 @@ class LightningNode(object): raise ValueError("Error waiting for a route to destination {}".format(destination)) # This helper waits for all HTLCs to settle - def wait_for_htlcs(self): + # `scids` can be a list of strings. If unset wait on all channels. + def wait_for_htlcs(self, scids=None): peers = self.rpc.listpeers()['peers'] for p, peer in enumerate(peers): if 'channels' in peer: for c, channel in enumerate(peer['channels']): + if scids is not None and channel['short_channel_id'] not in scids: + continue if 'htlcs' in channel: wait_for(lambda: len(self.rpc.listpeers()['peers'][p]['channels'][c]['htlcs']) == 0)