From fcbd1e14d36a12c950d6812f11a0d2ce135c3442 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Thu, 22 Aug 2024 11:22:53 +0200 Subject: [PATCH] lnwallet+itest: fix PaymentDescriptor creation for blinded path htlc This commit fixes the instantiation of the BlindingPoint member of PaymentDescriptor during the conversion from persisted LogUpdates. Previously, the blinding point was not set correctly. The test from the previous commit is also updated to now assert that this behaviour is now correct. --- itest/lnd_route_blinding_test.go | 9 +-------- lnwallet/channel.go | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/itest/lnd_route_blinding_test.go b/itest/lnd_route_blinding_test.go index 4e30ed546..a43f22a3a 100644 --- a/itest/lnd_route_blinding_test.go +++ b/itest/lnd_route_blinding_test.go @@ -1432,10 +1432,6 @@ func testMPPToMultipleBlindedPaths(ht *lntest.HarnessTest) { // a blinded path payment since this adds a new blinding point field to // UpdateAddHTLC which we need to ensure gets included in the message on // restart. -// -// NOTE: this first version of this test asserts that this fails. This is to -// demonstrate that a bug exists in the reloading and forwarding code. This will -// be fixed in a following commit. func testBlindedPaymentHTLCReForward(ht *lntest.HarnessTest) { // Setup a test case. ctx, testCase := newBlindedForwardTest(ht) @@ -1456,9 +1452,6 @@ func testBlindedPaymentHTLCReForward(ht *lntest.HarnessTest) { } // In a goroutine, we let Alice pay the invoice from dave. - // - // NOTE: for now, we assert that this attempt fails. Once the noted bug - // is fixed, this will be changed to a success assertion. done := make(chan struct{}) go func() { defer close(done) @@ -1468,7 +1461,7 @@ func testBlindedPaymentHTLCReForward(ht *lntest.HarnessTest) { ) require.NoError(testCase.ht, err) require.Equal( - testCase.ht, lnrpc.HTLCAttempt_FAILED, + testCase.ht, lnrpc.HTLCAttempt_SUCCEEDED, htlcAttempt.Status, ) }() diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 65ae01356..e3a777caa 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -205,7 +205,7 @@ func PayDescsFromRemoteLogUpdates(chanID lnwire.ShortChannelID, height uint64, Height: height, Index: uint16(i), }, - BlindingPoint: pd.BlindingPoint, + BlindingPoint: wireMsg.BlindingPoint, } pd.OnionBlob = make([]byte, len(wireMsg.OnionBlob)) copy(pd.OnionBlob[:], wireMsg.OnionBlob[:])