From b0852a22fda93d4716f5c9a047850f9b12d56d33 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 cf4497ed7..372466fe4 100644 --- a/itest/lnd_route_blinding_test.go +++ b/itest/lnd_route_blinding_test.go @@ -1428,10 +1428,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) @@ -1452,9 +1448,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) @@ -1464,7 +1457,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 7a6278522..7bd382d2c 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[:])