@@ -15,6 +15,7 @@ import (
1515 "github.com/btcsuite/btcd/wire"
1616 "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
1717 "github.com/lightningnetwork/lnd/channeldb"
18+ "github.com/lightningnetwork/lnd/fn"
1819 "github.com/lightningnetwork/lnd/lnrpc"
1920 "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
2021 "github.com/lightningnetwork/lnd/lntypes"
@@ -1400,6 +1401,10 @@ func (s *Server) trackPaymentStream(context context.Context,
14001401func (s * Server ) BuildRoute (_ context.Context ,
14011402 req * BuildRouteRequest ) (* BuildRouteResponse , error ) {
14021403
1404+ if len (req .HopPubkeys ) == 0 {
1405+ return nil , errors .New ("no hops specified" )
1406+ }
1407+
14031408 // Unmarshall hop list.
14041409 hops := make ([]route.Vertex , len (req .HopPubkeys ))
14051410 for i , pubkeyBytes := range req .HopPubkeys {
@@ -1411,10 +1416,10 @@ func (s *Server) BuildRoute(_ context.Context,
14111416 }
14121417
14131418 // Prepare BuildRoute call parameters from rpc request.
1414- var amt * lnwire.MilliSatoshi
1419+ var amt fn. Option [ lnwire.MilliSatoshi ]
14151420 if req .AmtMsat != 0 {
14161421 rpcAmt := lnwire .MilliSatoshi (req .AmtMsat )
1417- amt = & rpcAmt
1422+ amt = fn . Some ( rpcAmt )
14181423 }
14191424
14201425 var outgoingChan * uint64
0 commit comments