From b0e1a722c6aa6a9b0bf17a91bf4505b4d9a4aff5 Mon Sep 17 00:00:00 2001 From: bitromortac Date: Wed, 7 Aug 2024 11:34:30 +0200 Subject: [PATCH] routerrpc: add check for empty hops --- lnrpc/routerrpc/router_server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnrpc/routerrpc/router_server.go b/lnrpc/routerrpc/router_server.go index 0391fe825..a88bb4d0c 100644 --- a/lnrpc/routerrpc/router_server.go +++ b/lnrpc/routerrpc/router_server.go @@ -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 {