mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-03 20:16:02 +02:00
routing: add cltv limit to payment session
This commit is contained in:
@ -138,6 +138,16 @@ func (p *paymentSession) RequestRoute(payment *LightningPayment,
|
||||
"edges, %v vertexes", len(pruneView.edges),
|
||||
len(pruneView.vertexes))
|
||||
|
||||
// If a route cltv limit was specified, we need to subtract the final
|
||||
// delta before passing it into path finding. The optimal path is
|
||||
// independent of the final cltv delta and the path finding algorithm is
|
||||
// unaware of this value.
|
||||
var cltvLimit *uint32
|
||||
if payment.CltvLimit != nil {
|
||||
limit := *payment.CltvLimit - uint32(finalCltvDelta)
|
||||
cltvLimit = &limit
|
||||
}
|
||||
|
||||
// TODO(roasbeef): sync logic amongst dist sys
|
||||
|
||||
// Taking into account this prune view, we'll attempt to locate a path
|
||||
@ -154,6 +164,7 @@ func (p *paymentSession) RequestRoute(payment *LightningPayment,
|
||||
IgnoredEdges: pruneView.edges,
|
||||
FeeLimit: payment.FeeLimit,
|
||||
OutgoingChannelID: payment.OutgoingChannelID,
|
||||
CltvLimit: cltvLimit,
|
||||
},
|
||||
p.mc.selfNode.PubKeyBytes, payment.Target,
|
||||
payment.Amount,
|
||||
|
Reference in New Issue
Block a user