From 568bcb1b93c7caa62c0a23ba0c0da643e5eb724a Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 2 Sep 2020 15:47:18 +0200 Subject: [PATCH] Rename to import-snapshot, require more than finality for state export Signed-off-by: Jakub Sztandera --- cli/chain.go | 7 +++++-- cmd/lotus/daemon.go | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/chain.go b/cli/chain.go index ea41537339c..1d203639a98 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 b7365662ea1..e9ec8f93093 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{