routing: check for empty hops list

This commit fixes a crash that could be triggered by sending an empty
hop list to the SendToRoute rpc.
This commit is contained in:
Joost Jager committed 2018-12-10 11:27:07 +01:00
1 parent 4d647b6e5d
commit b2cb760c65
4 files changed
+30 -5

No files matched your search

+4 -1
View File
@@ -3848,12 +3848,15 @@ func (r *rpcServer) unmarshallRoute(rpcroute *lnrpc.Route,
prevNodePubKey = routeHop.PubKeyBytes
}
route := routing.NewRouteFromHops(
route, err := routing.NewRouteFromHops(
lnwire.MilliSatoshi(rpcroute.TotalAmtMsat),
rpcroute.TotalTimeLock,
sourceNode.PubKeyBytes,
hops,
)
if err != nil {
return nil, err
}
return route, nil
}