From 79278b880fcbca780727dd1c562830b3f899fdce Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 7 Aug 2020 12:44:58 +0930 Subject: [PATCH] pytest: optimize join_nodes a little. We can query all the txids at once, rather than one at a time. Doesn't make any measurable difference to full runtime testing here though. Signed-off-by: Rusty Russell --- contrib/pyln-testing/pyln/testing/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index a9616bea1..e8b3bfda5 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -1095,9 +1095,11 @@ class NodeFactory(object): bitcoind.generate_block(1) sync_blockheight(bitcoind, nodes) + txids = [] for src, dst in connections: - tx = src.rpc.fundchannel(dst.info['id'], fundamount, announce=announce_channels) - wait_for(lambda: tx['txid'] in bitcoind.rpc.getrawmempool()) + txids.append(src.rpc.fundchannel(dst.info['id'], fundamount, announce=announce_channels)['txid']) + + wait_for(lambda: set(txids).issubset(set(bitcoind.rpc.getrawmempool()))) # Confirm all channels and wait for them to become usable bitcoind.generate_block(1)