diff --git a/libs/gl-testing/tests/test_gl_node.py b/libs/gl-testing/tests/test_gl_node.py index 0c4d69f90..de65971a8 100644 --- a/libs/gl-testing/tests/test_gl_node.py +++ b/libs/gl-testing/tests/test_gl_node.py @@ -125,24 +125,23 @@ def check(gl1): wait_for(lambda: check(gl1)) def test_configure_close_to_addr(node_factory, clients, bitcoind): - l1, l2 = node_factory.line_graph(2) - l2.fundwallet(sats=2*10**6) - + l1 = node_factory.get_node() c = clients.new() c.register(configure=True) gl1 = c.node() - - s = c.signer().run_in_thread() - gl1.connect_peer(l2.info['id'], f'127.0.0.1:{l2.daemon.port}') + s = c.signer().run_in_thread() + close_to_addr = bitcoind.getnewaddress() gl1.configure(close_to_addr) + + gl1.connect_peer(l1.info['id'], f'127.0.0.1:{l1.daemon.port}') - l2.rpc.fundchannel(c.node_id.hex(), 'all') - bitcoind.generate_block(1, wait_for_mempool=1) + l1.fundwallet(sats=2*10**6) + l1.rpc.fundchannel(c.node_id.hex(), 'all') + bitcoind.generate_block(6, wait_for_mempool=1) - wait_for(lambda: - gl1.list_peers().peers[0].channels[0].state == 2 - ) + wait_for(lambda: len(gl1.list_peer_channels().channels) > 0) + wait_for(lambda: gl1.list_peer_channels().channels[0].state == 2) - assert gl1.list_peers().peers[0].channels[0].close_to_addr == close_to_addr + assert gl1.list_peer_channels().channels[0].close_to_addr == close_to_addr diff --git a/libs/gl-testing/tests/test_node.py b/libs/gl-testing/tests/test_node.py index f7d2c8b7c..1e9950faf 100644 --- a/libs/gl-testing/tests/test_node.py +++ b/libs/gl-testing/tests/test_node.py @@ -81,7 +81,8 @@ def test_node_network(node_factory, clients, bitcoind): bitcoind.generate_block(6, wait_for_mempool=1) # Now wait for the channel to confirm - wait_for(lambda: gl1.list_peers().peers[0].channels[0].state == 'CHANNELD_NORMAL') + wait_for(lambda: len(gl1.list_peer_channels().channels) > 0) + wait_for(lambda: gl1.list_peer_channels().channels[0].state == 2) # CHANNELD_NORMAL wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 2) inv = gl1.invoice( @@ -163,7 +164,10 @@ def test_node_invoice_amountless(bitcoind, node_factory, clients): amount=clnpb.AmountOrAll(amount=clnpb.Amount(msat=10**9)) ) bitcoind.generate_block(6, wait_for_mempool=1) - wait_for(lambda: gl1.list_peers().peers[0].channels[0].state == 2) # CHANNELD_NORMAL + + # the channels array is optional + wait_for(lambda: len(gl1.list_peer_channels().channels) > 0) + wait_for(lambda: gl1.list_peer_channels().channels[0].state == 2) # CHANNELD_NORMAL # Generate an invoice without amount: inv = l1.rpc.call('invoice', payload={ @@ -201,7 +205,10 @@ def test_node_listpays_preimage(clients, node_factory, bitcoind): amount=clnpb.AmountOrAll(amount=clnpb.Amount(msat=10**9)) ) bitcoind.generate_block(6, wait_for_mempool=1) - wait_for(lambda: gl1.list_peers().peers[0].channels[0].state == 2) # CHANNELD_NORMAL + + # the channels array is optional + wait_for(lambda: len(gl1.list_peer_channels().channels) > 0) + wait_for(lambda: gl1.list_peer_channels().channels[0].state == 2) # CHANNELD_NORMAL preimage = "00"*32