From 1ad72fdafde0237a097d1d788787ff3b06250e8f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 8 Feb 2026 16:26:59 +1030 Subject: [PATCH] pytest: fix test_xpay flake. ``` > assert len(layers['layers']) == 1 E AssertionError: assert 2 == 1 E + where 2 = len([{'layer': 'xpay', 'persistent': True, 'disabled_nodes': [], 'created_channels': [], 'channel_updates': [], 'constraints': [{'short_channel_id_dir': '45210x2134x44171/0', 'timestamp': 1770341134, 'minimum_msat': 289153519}, {'short_channel_id_dir': '1895x7x1895/1', 'timestamp': 1770341134, 'minimum_msat': 289007015}, {'short_channel_id_dir': '1906x1039x1906/1', 'timestamp': 1770341134, 'minimum_msat': 289008304}, {'short_channel_id_dir': '10070x60x10063/1', 'timestamp': 1770341134, 'minimum_msat': 289005726}, {'short_channel_id_dir': '18772x60x18743/0', 'timestamp': 1770341134, 'minimum_msat': 289005726}, {'short_channel_id_dir': '18623x208x18594/0', 'timestamp': 1770341134, 'minimum_msat': 289004859}, {'short_channel_id_dir': '33935x826x33727/1', 'timestamp': 1770341134, 'maximum_msat': 491501488}], 'biases': [], 'node_biases': []}, {'layer': 'xpay-94', 'persistent': False, 'disabled_nodes': [], 'created_channels': [], 'channel_updates': [], 'constraints': [], 'biases': [], 'node_biases': []}]) ``` Signed-off-by: Rusty Russell --- tests/test_xpay.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_xpay.py b/tests/test_xpay.py index 4fb9381a9..90d191b16 100644 --- a/tests/test_xpay.py +++ b/tests/test_xpay.py @@ -281,12 +281,12 @@ def test_xpay_fake_channeld(node_factory, bitcoind, chainparams, slow_mode): # Should be no reservations left (clean up happens after return though) wait_for(lambda: l1.rpc.askrene_listreservations() == {'reservations': []}) + # Wait for temporary layers to be gone too. + wait_for(lambda: len(l1.rpc.askrene_listlayers()['layers']) == 1) + # It should remember the information it learned across restarts! # FIXME: channeld_fakenet doesn't restart properly, so just redo xpay. layers = l1.rpc.askrene_listlayers() - # Temporary layers should be gone. - assert len(layers['layers']) == 1 - l1.rpc.plugin_stop("cln-askrene") l1.rpc.plugin_start(os.path.join(os.getcwd(), 'plugins/cln-askrene')) layers_after = l1.rpc.askrene_listlayers()