lnrpc+routing: Only accept a single route for SendToRoute

This commit is contained in:
Joost Jager
2018-08-08 11:09:30 +02:00
parent 0b66d56aab
commit ba3fa94268
10 changed files with 693 additions and 736 deletions

View File

@@ -2476,9 +2476,18 @@ func sendToRoute(ctx *cli.Context) error {
"from incoming array of routes: %v", err)
}
if len(routes.Routes) == 0 {
return fmt.Errorf("no routes provided")
}
if len(routes.Routes) != 1 {
return fmt.Errorf("expected a single route, but got %v",
len(routes.Routes))
}
req := &lnrpc.SendToRouteRequest{
PaymentHash: rHash,
Routes: routes.Routes,
Route: routes.Routes[0],
}
return sendToRouteRequest(ctx, req)