From 5095e6f07b68dd2abb96a6b116dd10a3602ee0a3 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Fri, 28 Aug 2020 22:15:43 -0400 Subject: [PATCH] Fix chain import --- cmd/lotus/daemon.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 848596944..a99b0c104 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -345,6 +345,16 @@ func ImportChain(r repo.Repo, fname string) error { return xerrors.Errorf("importing chain failed: %w", err) } + gb, err := cst.GetTipsetByHeight(context.TODO(), 0, ts, true) + if err != nil { + return err + } + + err = cst.SetGenesis(gb.Blocks()[0]) + if err != nil { + return err + } + stm := stmgr.NewStateManager(cst) log.Infof("validating imported chain...")