routing: dont include final hop cltv in blinded path

Only include the final hop's cltv delta in the total timelock
calculation if the route does not include a blinded path. This is
because in a blinded path, the final hops final cltv delta will be
included in the blinded path's accumlated cltv delta value.

With this commit, we remove the responsibility of remembering not to set
the `finalHop.cltvDelta` from the caller of `newRoute`. The relevant
test is updated accordingly.
This commit is contained in:
Elle Mouton committed 2024-07-10 17:51:56 +02:00
1 parent 93f89512ae
commit cd3da40fb9
4 files changed
+52 -14

No files matched your search

+8 -5
View File
@@ -3322,16 +3322,19 @@ func TestBlindedRouteConstruction(t *testing.T) {
ToNodeFeatures: tlvFeatures,
}
// Create final hop parameters for payment amount = 110. Note
// that final cltv delta is not set because blinded paths
// include this final delta in their aggregate delta. A
// sender-set delta may be added to account for block arrival
// during payment, but we do not set it in this test.
// Create final hop parameters for payment amount = 110.
totalAmt lnwire.MilliSatoshi = 110
finalHopParams = finalHopParams{
amt: totalAmt,
totalAmt: totalAmt,
metadata: metadata,
// We set a CLTV delta here just to test that this will
// be ignored by newRoute since this is a blinded path
// where the accumulated CLTV delta for the route
// communicated in the blinded path should be assumed to
// include the CLTV delta of the final hop.
cltvDelta: MaxCLTVDelta,
}
)