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
@ -1164,6 +1164,13 @@ type LightningPayment struct {
|
||||
// the first hop.
|
||||
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?
|
||||
}
|
||||
|
||||
@ -1194,6 +1201,13 @@ func (r *ChannelRouter) SendPayment(payment *LightningPayment) ([32]byte, *Route
|
||||
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
|
||||
// critical error during path finding.
|
||||
for {
|
||||
|
Loading…
Reference in New Issue
Block a user