From e0c21debc202e6466818ffdc790fb52e4b59de70 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 15 Jul 2018 11:19:38 +0930 Subject: [PATCH] pytest: fix sleep(1) in test_channel_persistence. It's obviously not enough under load, as Travis demonstrates. Signed-off-by: Rusty Russell --- tests/test_lightningd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 5527ee050..c4568aa18 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -4148,8 +4148,10 @@ class LightningDTests(BaseLightningDTests): # Now make sure this is really functional by sending a payment self.pay(l1, l2, 10000) - time.sleep(1) - assert l1.rpc.listpeers()['peers'][0]['channels'][0]['msatoshi_to_us'] == 99980000 + + # L1 doesn't actually update msatoshi_to_us until it receives + # revoke_and_ack from L2, which can take a little bit. + wait_for(lambda: l1.rpc.listpeers()['peers'][0]['channels'][0]['msatoshi_to_us'] == 99980000) assert l2.rpc.listpeers()['peers'][0]['channels'][0]['msatoshi_to_us'] == 20000 # Finally restart l1, and make sure it remembers