From 0453078213800cb4fb367a5c3ec380903154d810 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 25 Dec 2018 13:09:34 -0600 Subject: [PATCH] cmd/lncli: increase lightning gRPC block size to 50MB In this commit, we increase the gRPC block size from 4MB to 50MB. Recently, the output of `lncli describegraph` has hit the block size cap due to the expansion of the mainnet graph. Without this attempts to fetch the graph returns an error of: ``` [lncli] rpc error: code = ResourceExhausted desc = grpc: received message larger than max (4246753 vs. 4194304) ``` With this commit, we give ourselves some breathing room. It's important to note that the max message size limit is a _client side_ setting. As a result, any developers driving `lnd` with gRPC will also need to raise their block size limit as well if they wish to fetch the graph over gRPC. --- cmd/lncli/main.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/lncli/main.go b/cmd/lncli/main.go index d5f994c1..b5c2db5b 100644 --- a/cmd/lncli/main.go +++ b/cmd/lncli/main.go @@ -37,6 +37,10 @@ const ( var ( defaultLndDir = btcutil.AppDataDir("lnd", false) defaultTLSCertPath = filepath.Join(defaultLndDir, defaultTLSCertFilename) + + // maxMsgRecvSize is the largest message our client will receive. We + // set this to ~50Mb atm. + maxMsgRecvSize = grpc.MaxCallRecvMsgSize(1 * 1024 * 1024 * 50) ) func fatal(err error) { @@ -131,11 +135,10 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn { // We need to use a custom dialer so we can also connect to unix sockets // and not just TCP addresses. - opts = append( - opts, grpc.WithDialer( - lncfg.ClientAddressDialer(defaultRPCPort), - ), - ) + genericDialer := lncfg.ClientAddressDialer(defaultRPCPort) + opts = append(opts, grpc.WithDialer(genericDialer)) + opts = append(opts, grpc.WithDefaultCallOptions(maxMsgRecvSize)) + conn, err := grpc.Dial(ctx.GlobalString("rpcserver"), opts...) if err != nil { fatal(fmt.Errorf("unable to connect to RPC server: %v", err))