itest: fix flake in testIntroductionNodeError
What changed, and why it matters
This is a test-only change that adds a short sleep to an integration test to avoid a race condition between payment completion and event subscription. It does not change production code or affect real users' funds, channels, or node security.
No security action needed. This is a test reliability fix; review and merge as normal.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds flakePaymentStreamReturnEarly() in testIntroductionNodeError after draining Carol’s liquidity. The drain triggers a payment from Bob, which can leave SEND-type HTLC notifier events in-flight because SendPaymentV2 returns success before the revoke-and-ack commitment dance finishes. If the test subscribes to HTLC events before those stale events are flushed, they can be delivered to the new subscriber and corrupt a later FORWARD-type assertion. The same workaround already exists in testRelayingBlindedError. No production code is modified.
Changed components
itest/lnd_route_blinding_test.goInspect captured patch +7 / −0
diff --git a/itest/lnd_route_blinding_test.go b/itest/lnd_route_blinding_test.go
index 3ad1f45..2c69548 100644
--- a/itest/lnd_route_blinding_test.go
+++ b/itest/lnd_route_blinding_test.go
@@ -704,6 +704,13 @@ func testIntroductionNodeError(ht *lntest.HarnessTest) {
// at the introduction node.
testCase.drainCarolLiquidity(true)
+ // NOTE: The drain above causes Bob to originate a payment, producing
+ // SEND-type HTLC events that may still be in-flight when we subscribe.
+ // Wait for the commitment dance to finish so those events are flushed
+ // before we subscribe, preventing them from corrupting the assertion
+ // below.
+ flakePaymentStreamReturnEarly()
+
// Subscribe to Bob's HTLC events so that we can observe the payment
// coming in.
bobEvents := bob.RPC.SubscribeHtlcEvents()
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.