mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
routing: let BlindedPaymentPathSet handle FinalCLTV logic
Instead of needing to remember how to handle the FinalCLTV value of a blinded payment path at various points in the code base, we hide the logic behind a unified FinalCLTVDelta method on the blinded path.
This commit is contained in:
@@ -210,21 +210,12 @@ func newRoute(sourceVertex route.Vertex,
|
||||
// reporting through RPC. Set to zero for the final hop.
|
||||
fee = 0
|
||||
|
||||
// Only include the final hop CLTV delta in the total
|
||||
// time lock value if this is not a route to a blinded
|
||||
// path. For blinded paths, the total time-lock from the
|
||||
// whole path will be deduced from the introduction
|
||||
// node's CLTV delta. The exception is for the case
|
||||
// where the final hop is the blinded path introduction
|
||||
// node.
|
||||
if blindedPathSet == nil ||
|
||||
len(blindedPathSet.GetPath().BlindedPath.
|
||||
BlindedHops) == 1 {
|
||||
|
||||
// As this is the last hop, we'll use the
|
||||
// specified final CLTV delta value instead of
|
||||
// the value from the last link in the route.
|
||||
if blindedPathSet == nil {
|
||||
totalTimeLock += uint32(finalHop.cltvDelta)
|
||||
} else {
|
||||
totalTimeLock += uint32(
|
||||
blindedPathSet.FinalCLTVDelta(),
|
||||
)
|
||||
}
|
||||
outgoingTimeLock = totalTimeLock
|
||||
|
||||
|
Reference in New Issue
Block a user