From 392c1a9a1b6e42df9c5d168f2b61fa941c1e3a07 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 4 Dec 2019 14:35:43 -0800 Subject: [PATCH] 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. --- lnrpc/routerrpc/router_backend.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lnrpc/routerrpc/router_backend.go b/lnrpc/routerrpc/router_backend.go index 46e0ba8a..38c4a1b7 100644 --- a/lnrpc/routerrpc/router_backend.go +++ b/lnrpc/routerrpc/router_backend.go @@ -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