diff --git a/cmd/lotus-gateway/main.go b/cmd/lotus-gateway/main.go index e2ef27dd9e2..60f45f283f4 100644 --- a/cmd/lotus-gateway/main.go +++ b/cmd/lotus-gateway/main.go @@ -8,6 +8,7 @@ import ( "contrib.go.opencensus.io/exporter/prometheus" "github.com/filecoin-project/go-jsonrpc" + "github.com/filecoin-project/go-state-types/abi" promclient "github.com/prometheus/client_golang/prometheus" "go.opencensus.io/tag" @@ -70,6 +71,16 @@ var runCmd = &cli.Command{ Name: "api-max-req-size", Usage: "maximum API request size accepted by the JSON RPC server", }, + &cli.DurationFlag{ + Name: "api-max-lookback", + Usage: "maximum duration allowable for tipset lookbacks", + Value: LookbackCap, + }, + &cli.Int64Flag{ + Name: "api-wait-lookback-limit", + Usage: "maximum number of blocks to search back through for message inclusion", + Value: int64(StateWaitLookbackLimit), + }, }, Action: func(cctx *cli.Context) error { log.Info("Starting lotus gateway") @@ -107,7 +118,11 @@ var runCmd = &cli.Command{ mux.Handle(path, rpcServer) } - ma := metrics.MetricedGatewayAPI(NewGatewayAPI(api)) + lookbackCap := cctx.Duration("api-max-lookback") + + waitLookback := abi.ChainEpoch(cctx.Int64("api-wait-lookback-limit")) + + ma := metrics.MetricedGatewayAPI(newGatewayAPI(api, lookbackCap, waitLookback)) serveRpc("/rpc/v1", ma) serveRpc("/rpc/v0", lapi.Wrap(new(v1api.FullNodeStruct), new(v0api.WrapperV1Full), ma))