lnrpc: deprecate multiple routes sendtoroute
This commit is contained in:
4 files changed
+597
-557
No files matched your search
+565
-549
File diff suppressed because it is too large.
Load diff
+10
-2
@@ -781,8 +781,16 @@ message SendToRouteRequest {
|
||||
/// An optional hex-encoded payment hash to be used for the HTLC.
|
||||
string payment_hash_string = 2;
|
||||
|
||||
/// The set of routes that should be used to attempt to complete the payment.
|
||||
repeated Route routes = 3;
|
||||
/**
|
||||
Deprecated. The set of routes that should be used to attempt to complete the
|
||||
payment. The possibility to pass in multiple routes is deprecated and
|
||||
instead the single route field below should be used in combination with the
|
||||
streaming variant of SendToRoute.
|
||||
*/
|
||||
repeated Route routes = 3 [deprecated = true];
|
||||
|
||||
/// Route that should be used to attempt to complete the payment.
|
||||
Route route = 4;
|
||||
}
|
||||
|
||||
message ChannelPoint {
|
||||
|
||||
@@ -2911,7 +2911,11 @@
|
||||
"items": {
|
||||
"$ref": "#/definitions/lnrpcRoute"
|
||||
},
|
||||
"description": "/ The set of routes that should be used to attempt to complete the payment."
|
||||
"description": "*\nDeprecated. The set of routes that should be used to attempt to complete the\npayment. The possibility to pass in multiple routes is deprecated and \ninstead the single route field below should be used in combination with the \nstreaming variant of SendToRoute."
|
||||
},
|
||||
"route": {
|
||||
"$ref": "#/definitions/lnrpcRoute",
|
||||
"description": "/ Route that should be used to attempt to complete the payment."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+17
-5
@@ -2580,17 +2580,29 @@ func (r *rpcServer) SendToRoute(stream lnrpc.Lightning_SendToRouteServer) error
|
||||
func unmarshallSendToRouteRequest(req *lnrpc.SendToRouteRequest,
|
||||
graph *channeldb.ChannelGraph) (*rpcPaymentRequest, error) {
|
||||
|
||||
if len(req.Routes) == 0 {
|
||||
switch {
|
||||
case len(req.Routes) == 0 && req.Route == nil:
|
||||
return nil, fmt.Errorf("unable to send, no routes provided")
|
||||
case len(req.Routes) > 0 && req.Route != nil:
|
||||
return nil, fmt.Errorf("cannot use both route and routes field")
|
||||
}
|
||||
|
||||
routes := make([]*routing.Route, len(req.Routes))
|
||||
for i, rpcroute := range req.Routes {
|
||||
route, err := unmarshallRoute(rpcroute, graph)
|
||||
var routes []*routing.Route
|
||||
if len(req.Routes) > 0 {
|
||||
routes = make([]*routing.Route, len(req.Routes))
|
||||
for i, rpcroute := range req.Routes {
|
||||
route, err := unmarshallRoute(rpcroute, graph)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
routes[i] = route
|
||||
}
|
||||
} else {
|
||||
route, err := unmarshallRoute(req.Route, graph)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
routes[i] = route
|
||||
routes = []*routing.Route{route}
|
||||
}
|
||||
|
||||
return &rpcPaymentRequest{
|
||||
|
||||
Reference in new issue
Block a user