lnrpc: add payment cltv limit

This commit is contained in:
John Griffith 2018-11-04 10:11:48 +00:00 committed by Joost Jager
parent 06cd64cbbc
commit acb8fd4796
No known key found for this signature in database
GPG key ID: A61B9D4C393C59C7
4 changed files with 614 additions and 583 deletions

File diff suppressed because it is too large Load diff

View file

@ -790,7 +790,14 @@ message SendRequest {
any channel may be used.
*/
uint64 outgoing_chan_id = 9;
/**
An optional maximum total time lock for the route. If zero, there is no
maximum enforced.
*/
uint32 cltv_limit = 10;
}
message SendResponse {
string payment_error = 1 [json_name = "payment_error"];
bytes payment_preimage = 2 [json_name = "payment_preimage"];

View file

@ -2977,6 +2977,11 @@
"type": "string",
"format": "uint64",
"description": "*\nThe channel id of the channel that must be taken to the first hop. If zero,\nany channel may be used."
},
"cltv_limit": {
"type": "integer",
"format": "int64",
"description": "* \nAn optional maximum total time lock for the route. If zero, there is no\nmaximum enforced."
}
}
},

View file

@ -2852,6 +2852,7 @@ func unmarshallSendToRouteRequest(req *lnrpc.SendToRouteRequest,
type rpcPaymentIntent struct {
msat lnwire.MilliSatoshi
feeLimit lnwire.MilliSatoshi
cltvLimit *uint32
dest routing.Vertex
rHash [32]byte
cltvDelta uint16
@ -2895,6 +2896,11 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
payIntent.outgoingChannelID = &rpcPayReq.OutgoingChanId
}
// Take cltv limit from request if set.
if rpcPayReq.CltvLimit != 0 {
payIntent.cltvLimit = &rpcPayReq.CltvLimit
}
// If the payment request field isn't blank, then the details of the
// invoice are encoded entirely within the encoded payReq. So we'll
// attempt to decode it, populating the payment accordingly.
@ -3044,6 +3050,7 @@ func (r *rpcServer) dispatchPaymentIntent(
Target: payIntent.dest,
Amount: payIntent.msat,
FeeLimit: payIntent.feeLimit,
CltvLimit: payIntent.cltvLimit,
PaymentHash: payIntent.rHash,
RouteHints: payIntent.routeHints,
OutgoingChannelID: payIntent.outgoingChannelID,