lnrpc/routerrpc: make SendToRoute consistent with other payment RPCs

In this commitment, we make the `SendToRoute` RPC call consistent with
all the other payment RPCs which will properly adhere to the current max
payment sat limit. This is a prep commit for the future wumbo soft cap
that will eventually land in lnd.
This commit is contained in:
Olaoluwa Osuntokun 2019-12-04 14:35:43 -08:00
parent 06e8d1c5ca
commit 392c1a9a1b
No known key found for this signature in database
GPG Key ID: BC13F65E2DC84465

@ -470,6 +470,13 @@ func (r *RouterBackend) UnmarshallRoute(rpcroute *lnrpc.Route) (
return nil, err
}
if routeHop.AmtToForward > r.MaxPaymentMSat {
return nil, fmt.Errorf("payment of %v is too large, "+
"max payment allowed is %v",
routeHop.AmtToForward,
r.MaxPaymentMSat.ToSatoshis())
}
hops[i] = routeHop
prevNodePubKey = routeHop.PubKeyBytes