From 64ea88310598e321fd275f99afc6a8851226e6ad Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Tue, 22 Mar 2022 12:40:08 +0100 Subject: [PATCH] switch+test: fix race condition in unit test --- docs/release-notes/release-notes-0.15.0.md | 4 ++++ htlcswitch/switch_test.go | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/release-notes/release-notes-0.15.0.md b/docs/release-notes/release-notes-0.15.0.md index 59124c200..91a8fbae2 100644 --- a/docs/release-notes/release-notes-0.15.0.md +++ b/docs/release-notes/release-notes-0.15.0.md @@ -101,6 +101,10 @@ * [Make etcd leader election session TTL](https://github.com/lightningnetwork/lnd/pull/6342) configurable. + +* [Fix race condition in the htlc interceptor unit + test](https://github.com/lightningnetwork/lnd/pull/6353). + ## RPC Server * [Add value to the field diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index 148a19539..b50f8dbe6 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -3287,7 +3287,7 @@ func TestSwitchHoldForward(t *testing.T) { assertNumCircuits(t, s, 0, 0) assertOutgoingLinkReceive(t, bobChannelLink, false) - require.NoError(t, switchForwardInterceptor.resolve(&FwdResolution{ + require.NoError(t, switchForwardInterceptor.Resolve(&FwdResolution{ Action: FwdActionResume, Key: forwardInterceptor.getIntercepted().IncomingCircuit, })) @@ -3347,7 +3347,7 @@ func TestSwitchHoldForward(t *testing.T) { assertNumCircuits(t, s, 0, 0) assertOutgoingLinkReceive(t, bobChannelLink, false) - require.NoError(t, switchForwardInterceptor.resolve(&FwdResolution{ + require.NoError(t, switchForwardInterceptor.Resolve(&FwdResolution{ Action: FwdActionFail, Key: forwardInterceptor.getIntercepted().IncomingCircuit, FailureCode: lnwire.CodeTemporaryChannelFailure, @@ -3364,7 +3364,7 @@ func TestSwitchHoldForward(t *testing.T) { assertOutgoingLinkReceive(t, bobChannelLink, false) reason := lnwire.OpaqueReason([]byte{1, 2, 3}) - require.NoError(t, switchForwardInterceptor.resolve(&FwdResolution{ + require.NoError(t, switchForwardInterceptor.Resolve(&FwdResolution{ Action: FwdActionFail, Key: forwardInterceptor.getIntercepted().IncomingCircuit, FailureMessage: reason, @@ -3385,7 +3385,7 @@ func TestSwitchHoldForward(t *testing.T) { assertOutgoingLinkReceive(t, bobChannelLink, false) code := lnwire.CodeInvalidOnionKey - require.NoError(t, switchForwardInterceptor.resolve(&FwdResolution{ + require.NoError(t, switchForwardInterceptor.Resolve(&FwdResolution{ Action: FwdActionFail, Key: forwardInterceptor.getIntercepted().IncomingCircuit, FailureCode: code, @@ -3413,7 +3413,7 @@ func TestSwitchHoldForward(t *testing.T) { assertNumCircuits(t, s, 0, 0) assertOutgoingLinkReceive(t, bobChannelLink, false) - require.NoError(t, switchForwardInterceptor.resolve(&FwdResolution{ + require.NoError(t, switchForwardInterceptor.Resolve(&FwdResolution{ Key: forwardInterceptor.getIntercepted().IncomingCircuit, Action: FwdActionSettle, Preimage: preimage, @@ -3473,7 +3473,7 @@ func TestSwitchHoldForward(t *testing.T) { intercepted := forwardInterceptor.getIntercepted() // Settle the packet. - require.NoError(t, switchForwardInterceptor.resolve(&FwdResolution{ + require.NoError(t, switchForwardInterceptor.Resolve(&FwdResolution{ Key: intercepted.IncomingCircuit, Action: FwdActionSettle, Preimage: preimage,