mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-30 01:30:11 +02:00
lnrpc: deprecate multiple routes sendtoroute
This commit is contained in:
parent
5a4951affd
commit
17645fefdf
1114
lnrpc/rpc.pb.go
1114
lnrpc/rpc.pb.go
File diff suppressed because it is too large
Load Diff
@ -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."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
22
rpcserver.go
22
rpcserver.go
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user