tests: avoid flaky test_bkpr_currency_dynamic on same-second channel_mvt
What changed, and why it matters
This is a test-only change that adds a one-second delay in an automated test to prevent flaky results. It does not change any production code, network behavior, or security logic.
No security action needed. Treat as a normal test reliability fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tests/test_currencyrate.py by inserting time.sleep(1) between two invoice/setconfig operations in test_bkpr_currency_dynamic. The bookkeeper’s FX coverage uses Unix-second intervals, and when two events occur in the same second the test could non-deterministically attach a currencyrate to the wrong event. The fix ensures the second event lands in a different second, eliminating the race in the test assertion. No runtime code is affected.
Changed components
tests/test_currencyrate.pyInspect captured patch +2 / −0
diff --git a/tests/test_currencyrate.py b/tests/test_currencyrate.py
index 8431e529..afb75851 100644
--- a/tests/test_currencyrate.py
+++ b/tests/test_currencyrate.py
@@ -401,6 +401,8 @@ def test_bkpr_currency_dynamic(node_factory, fake_rateserver):
assert all("currencyrate" not in e for e in events)
num_events_1 = len(events)
+ time.sleep(1)
+
l1.rpc.setconfig("bkpr-currency", "USD")
inv2 = l2.rpc.invoice(100000, "test_bkpr_currency_dynamic_2", "desc")
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.