mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 05:14:04 +02:00
routing: move default cltv assignment out of router
This commit lifts default setting up to the rpc server level, in line with other payment defaults.
This commit is contained in:
13
rpcserver.go
13
rpcserver.go
@@ -2998,7 +2998,11 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
|
||||
rpcPayReq.FeeLimit, payIntent.msat,
|
||||
)
|
||||
|
||||
payIntent.cltvDelta = uint16(rpcPayReq.FinalCltvDelta)
|
||||
if rpcPayReq.FinalCltvDelta != 0 {
|
||||
payIntent.cltvDelta = uint16(rpcPayReq.FinalCltvDelta)
|
||||
} else {
|
||||
payIntent.cltvDelta = zpay32.DefaultFinalCLTVDelta
|
||||
}
|
||||
|
||||
// If the user is manually specifying payment details, then the payment
|
||||
// hash may be encoded as a string.
|
||||
@@ -3069,6 +3073,7 @@ func (r *rpcServer) dispatchPaymentIntent(
|
||||
payment := &routing.LightningPayment{
|
||||
Target: payIntent.dest,
|
||||
Amount: payIntent.msat,
|
||||
FinalCLTVDelta: payIntent.cltvDelta,
|
||||
FeeLimit: payIntent.feeLimit,
|
||||
CltvLimit: payIntent.cltvLimit,
|
||||
PaymentHash: payIntent.rHash,
|
||||
@@ -3077,12 +3082,6 @@ func (r *rpcServer) dispatchPaymentIntent(
|
||||
PaymentRequest: payIntent.payReq,
|
||||
}
|
||||
|
||||
// If the final CLTV value was specified, then we'll use that
|
||||
// rather than the default.
|
||||
if payIntent.cltvDelta != 0 {
|
||||
payment.FinalCLTVDelta = &payIntent.cltvDelta
|
||||
}
|
||||
|
||||
preImage, route, routerErr = r.server.chanRouter.SendPayment(
|
||||
payment,
|
||||
)
|
||||
|
Reference in New Issue
Block a user