diff --git a/tests/test_invoices.py b/tests/test_invoices.py index 77b4ebb35..24681fc84 100644 --- a/tests/test_invoices.py +++ b/tests/test_invoices.py @@ -122,9 +122,6 @@ def test_invoice_routeboost(node_factory): """ l1, l2 = node_factory.line_graph(2, announce=True, fundamount=10**4) - # Make sure we've seen channel_update from peer. - wait_for(lambda: [a['active'] for a in l2.rpc.listchannels()['channels']] == [True, True]) - # Make invoice and pay it inv = l2.rpc.invoice(msatoshi=123456, label="inv1", description="?") # Check routeboost. diff --git a/tests/test_pay.py b/tests/test_pay.py index 4567eda80..270d38aa9 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -133,15 +133,6 @@ def test_pay_get_error_with_update(node_factory): inv = l3.rpc.invoice(123000, 'test_pay_get_error_with_update', 'description') - def try_route(src, dst): - try: - src.rpc.getroute(dst.info['id'], 1, 1) - return True - except Exception: - return False - - wait_for(lambda: try_route(l1, l3)) - route = l1.rpc.getroute(l3.info['id'], 12300, 1)["route"] # Make sure l2 doesn't tell l1 directly that channel is disabled. diff --git a/tests/utils.py b/tests/utils.py index d88dd3a8f..f4437e80d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -804,15 +804,27 @@ class NodeFactory(object): # Confirm all channels and wait for them to become usable bitcoin.generate_block(1) + scids = [] for src, dst in connections: wait_for(lambda: src.channel_state(dst) == 'CHANNELD_NORMAL') scid = src.get_channel_scid(dst) src.daemon.wait_for_log(r'Received channel_update for channel {scid}\(.\) now ACTIVE'.format(scid=scid)) + scids.append(scid) if not announce: return nodes bitcoin.generate_block(5) + + def both_dirs_ready(n, scid): + resp = n.rpc.listchannels(scid) + return [a['active'] for a in resp['channels']] == [True, True] + + # Make sure everyone sees all channels: we can cheat and + # simply check the ends (since it's a line). + wait_for(lambda: both_dirs_ready(nodes[0], scids[-1])) + wait_for(lambda: both_dirs_ready(nodes[-1], scids[0])) + return nodes def killall(self, expected_successes):