What changed, and why it matters
This commit fixes a flaky test in the project's automated test suite. The test sometimes failed because it checked for leftover temporary layers too early, before they had been cleaned up. The fix simply waits for cleanup to finish before checking. There is no security issue here.
No security action needed. This is a routine test-flake fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change modifies tests/test_xpay.py to move a wait_for() call before the assertion that only one Askrene layer remains. Previously, the test asserted immediately after wait_for() on reservations, but temporary layers (e.g., ‘xpay-94’) could still exist briefly. The fix waits for the layer count to reach 1 before asserting and before restarting the plugin. This is purely a test reliability improvement.
Changed components
tests/test_xpay.pyInspect captured patch +3 / −3
diff --git a/tests/test_xpay.py b/tests/test_xpay.py
index 4fb9381a..90d191b1 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()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.