diff --git a/cmd/loop/main.go b/cmd/loop/main.go index b8e1e02..31459fd 100644 --- a/cmd/loop/main.go +++ b/cmd/loop/main.go @@ -30,6 +30,10 @@ var ( maxRoutingFeeRate = int64(20000) defaultSwapWaitTime = 30 * time.Minute + + // maxMsgRecvSize is the largest message our client will receive. We + // set this to 200MiB atm. + maxMsgRecvSize = grpc.MaxCallRecvMsgSize(1 * 1024 * 1024 * 200) ) func printJSON(resp interface{}) { @@ -233,6 +237,7 @@ func logSwap(swap *looprpc.SwapStatus) { func getClientConn(address string) (*grpc.ClientConn, error) { opts := []grpc.DialOption{ grpc.WithInsecure(), + grpc.WithDefaultCallOptions(maxMsgRecvSize), } conn, err := grpc.Dial(address, opts...) diff --git a/loopd/daemon.go b/loopd/daemon.go index 8313382..358841e 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -20,6 +20,12 @@ import ( "google.golang.org/grpc" ) +var ( + // maxMsgRecvSize is the largest message our REST proxy will receive. We + // set this to 200MiB atm. + maxMsgRecvSize = grpc.MaxCallRecvMsgSize(1 * 1024 * 1024 * 200) +) + // listenerCfg holds closures used to retrieve listeners for the gRPC services. type listenerCfg struct { // grpcListener returns a listener to use for the gRPC server. @@ -113,7 +119,10 @@ func daemon(config *config, lisCfg *listenerCfg) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() mux := proxy.NewServeMux(customMarshalerOption) - proxyOpts := []grpc.DialOption{grpc.WithInsecure()} + proxyOpts := []grpc.DialOption{ + grpc.WithInsecure(), + grpc.WithDefaultCallOptions(maxMsgRecvSize), + } err = looprpc.RegisterSwapClientHandlerFromEndpoint( ctx, mux, config.RPCListen, proxyOpts, )