diff --git a/cli/chain.go b/cli/chain.go index ea4153733..1d203639a 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -876,7 +876,10 @@ var chainExportCmd = &cli.Command{ return fmt.Errorf("must specify filename to export chain to") } - rsrs := cctx.Int64("recent-stateroots") + rsrs := abi.ChainEpoch(cctx.Int64("recent-stateroots")) + if cctx.IsSet("recent-stateroots") && rsrs < build.Finality { + return fmt.Errorf("\"recent-stateroots\" has to be greater than %d", build.Finality) + } fi, err := os.Create(cctx.Args().First()) if err != nil { @@ -894,7 +897,7 @@ var chainExportCmd = &cli.Command{ return err } - stream, err := api.ChainExport(ctx, abi.ChainEpoch(rsrs), ts.Key()) + stream, err := api.ChainExport(ctx, rsrs, ts.Key()) if err != nil { return err } diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index b7365662e..e0fee6564 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -100,10 +100,10 @@ var DaemonCmd = &cli.Command{ }, &cli.StringFlag{ Name: "import-chain", - Usage: "on first run, load chain from given file", + Usage: "on first run, load chain from given file and validate", }, &cli.StringFlag{ - Name: "snapshot", + Name: "import-snapshot", Usage: "import chain state from a given chain export file", }, &cli.BoolFlag{ @@ -195,10 +195,10 @@ var DaemonCmd = &cli.Command{ } chainfile := cctx.String("import-chain") - snapshot := cctx.String("snapshot") + snapshot := cctx.String("import-snapshot") if chainfile != "" || snapshot != "" { if chainfile != "" && snapshot != "" { - return fmt.Errorf("cannot specify both 'snapshot' and 'import-chain'") + return fmt.Errorf("cannot specify both 'import-snapshot' and 'import-chain'") } var issnapshot bool if chainfile == "" {