routerrpc: add check for empty hops

This commit is contained in:
bitromortac 2024-08-07 11:34:30 +02:00
parent 452db01ad7
commit b0e1a722c6
No known key found for this signature in database
GPG key ID: 1965063FC13BEBE2

View file

@ -1401,6 +1401,10 @@ func (s *Server) trackPaymentStream(context context.Context,
func (s *Server) BuildRoute(_ context.Context,
req *BuildRouteRequest) (*BuildRouteResponse, error) {
if len(req.HopPubkeys) == 0 {
return nil, errors.New("no hops specified")
}
// Unmarshall hop list.
hops := make([]route.Vertex, len(req.HopPubkeys))
for i, pubkeyBytes := range req.HopPubkeys {