From 1b604d5dd62fc7c31826ea2854e3c426e2977312 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 29 Mar 2018 17:22:27 +0200 Subject: [PATCH] pytest: Wait for the funding transaction to be in the mempool This can lead to failures in the valgrind configuration. Signed-off-by: Christian Decker --- tests/test_lightningd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 3da507ecc..8fcebb150 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -288,9 +288,13 @@ class LightningDTests(BaseLightningDTests): def fund_channel(self, l1, l2, amount): # Generates a block, so we know next tx will be first in block. self.give_funds(l1, amount + 1000000) + num_tx = len(l1.bitcoin.rpc.getrawmempool()) + tx = l1.rpc.fundchannel(l2.info['id'], amount)['tx'] # Technically, this is async to fundchannel. l1.daemon.wait_for_log('sendrawtx exit 0') + + wait_for(lambda: len(l1.bitcoin.rpc.getrawmempool()) == num_tx + 1) l1.bitcoin.generate_block(1) # We wait until gossipd sees local update, as well as status NORMAL, # so it can definitely route through.