mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
routing: add new FinalCLTVDelta attribute to SendPayment
In this commit, we’ll now optionally allow the user to pass in the CLTV delta value specified by the recipient a payment. If the value isn’t specified, then we’ll use the current global default for the payment.
This commit is contained in:
parent
c8f45e3a04
commit
aee1619488
1 changed files with 14 additions and 0 deletions
|
@ -1164,6 +1164,13 @@ type LightningPayment struct {
|
||||||
// the first hop.
|
// the first hop.
|
||||||
PaymentHash [32]byte
|
PaymentHash [32]byte
|
||||||
|
|
||||||
|
// FinalCLTVDelta is the CTLV expiry delta to use for the _final_ hop
|
||||||
|
// in the route. This means that the final hop will have a CLTV delta
|
||||||
|
// of at least: currentHeight + FinalCLTVDelta. If this value is
|
||||||
|
// unspcified, then a default value of DefaultFinalCLTVDelta will be
|
||||||
|
// used.
|
||||||
|
FinalCLTVDelta *uint16
|
||||||
|
|
||||||
// TODO(roasbeef): add e2e message?
|
// TODO(roasbeef): add e2e message?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1194,6 +1201,13 @@ func (r *ChannelRouter) SendPayment(payment *LightningPayment) ([32]byte, *Route
|
||||||
return preImage, nil, err
|
return preImage, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var finalCLTVDelta uint16
|
||||||
|
if payment.FinalCLTVDelta == nil {
|
||||||
|
finalCLTVDelta = DefaultFinalCLTVDelta
|
||||||
|
} else {
|
||||||
|
finalCLTVDelta = *payment.FinalCLTVDelta
|
||||||
|
}
|
||||||
|
|
||||||
// We'll continue until either our payment succeeds, or we encounter a
|
// We'll continue until either our payment succeeds, or we encounter a
|
||||||
// critical error during path finding.
|
// critical error during path finding.
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Add table
Reference in a new issue