Skip to content

Commit e76a7a9

Browse files
committed
pytest: fix flake in test_anchorspend_using_to_remote
Make sure all nodes see all channels: ``` 2025-05-09T06:07:42.6214730Z > route = l1.rpc.getroute(l3.info['id'], amt, 1)['route'] 2025-05-09T06:07:42.6215091Z 2025-05-09T06:07:42.6215239Z tests/test_closing.py:4199: ... 2025-05-09T06:07:42.6241237Z E pyln.client.lightning.RpcError: RPC call failed: method: getroute, payload: {'id': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d', 'amount_msat': 100000000, 'riskfactor': 1, 'cltv': 9}, error: {'code': -32602, 'message': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d: unknown destination node_id (no public channels?)'} ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 65dccea commit e76a7a9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/test_closing.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,9 +4187,18 @@ def test_anchorspend_using_to_remote(node_factory, bitcoind, anchors):
41874187
# Don't need l4 any more
41884188
l4.stop()
41894189

4190+
for n in (l1, l2, l3):
4191+
wait_for(lambda: n.rpc.listchannels() == {'channels': []})
4192+
41904193
# Now l1->l2<-l3 but push funds to l2 so it can forward.
4191-
node_factory.join_nodes([l1, l2], wait_for_announce=True)
4192-
node_factory.join_nodes([l3, l2], wait_for_announce=True)
4194+
node_factory.join_nodes([l1, l2])
4195+
node_factory.join_nodes([l3, l2])
4196+
4197+
# Make sure everyone knows about everyone else!
4198+
bitcoind.generate_block(5)
4199+
for n in (l1, l2, l3):
4200+
wait_for(lambda: len(n.rpc.listchannels()['channels']) == 4)
4201+
41934202
l3.rpc.pay(l2.rpc.invoice(200000000, 'test2', 'test2')['bolt11'])
41944203
wait_for(lambda: only_one(l2.rpc.listpeerchannels(l3.info['id'])['channels'])['htlcs'] == [])
41954204

@@ -4203,13 +4212,13 @@ def test_anchorspend_using_to_remote(node_factory, bitcoind, anchors):
42034212
# Give l2 a sense of urgency, by ensuring there's an HTLC in-channel
42044213
# when it needs to go onchain.
42054214
# Make sure HTLC expiry is what we expect!
4206-
l2.daemon.wait_for_log('Adding HTLC 0 amount=100000000msat cltv=128 gave CHANNEL_ERR_ADD_OK')
4215+
l2.daemon.wait_for_log('Adding HTLC 0 amount=100000000msat cltv=123 gave CHANNEL_ERR_ADD_OK')
42074216

42084217
# Kill l1 and l3, we just care about l2.
42094218
l3.stop()
42104219
l1.stop()
42114220

4212-
for block in range(117, 128):
4221+
for block in range(112, 123):
42134222
bitcoind.generate_block(1)
42144223
sync_blockheight(bitcoind, [l2])
42154224

0 commit comments

Comments
 (0)