pyln-testing: add scids param to wait_for_htlcs

This commit is contained in:
Michael Schmoock 2021-02-03 12:21:36 +01:00 committed by Rusty Russell
parent d76ca6ed35
commit c8198d9820

View File

@ -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)