From e45e1f2b0ee7a8b26f08f41105b7c3ee28123aa0 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Mon, 10 Feb 2025 12:18:44 +0800 Subject: [PATCH] itest: fix flake in `testForwardInterceptorRestart` We need to make sure the links are recreated before calling the interceptor, otherwise we'd get the following error, causing the test to fail. ``` 2025-02-07 15:01:38.991 [ERR] RPCS interceptor.go:624: [/routerrpc.Router/HtlcInterceptor]: fwd (Chan ID=487:3:0, HTLC ID=0) not found ``` --- itest/lnd_forward_interceptor_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/itest/lnd_forward_interceptor_test.go b/itest/lnd_forward_interceptor_test.go index 7a6888a57..7e43e6a24 100644 --- a/itest/lnd_forward_interceptor_test.go +++ b/itest/lnd_forward_interceptor_test.go @@ -357,7 +357,7 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) { cfgs := [][]string{nil, nil, nil, nil} // Open and wait for channels. - _, nodes := ht.CreateSimpleNetwork(cfgs, p) + chanPoints, nodes := ht.CreateSimpleNetwork(cfgs, p) alice, bob, carol, dave := nodes[0], nodes[1], nodes[2], nodes[3] // Connect an interceptor to Bob's node. @@ -424,6 +424,13 @@ func testForwardInterceptorRestart(ht *lntest.HarnessTest) { require.NoError(ht, restartAlice(), "failed to restart alice") + // Once restarted, we will wait until the reestabilishment of the links, + // Alice=>Bob and Bob=>Carol, finish before calling the interceptors. We + // check this by asserting that Carol is now aware of the two channels + // being active again. + ht.AssertChannelInGraph(carol, chanPoints[0]) + ht.AssertChannelInGraph(carol, chanPoints[1]) + // We should get another notification about the held HTLC. packet = ht.ReceiveHtlcInterceptor(bobInterceptor)