From 5b795cad3d2693074d4bbea1286e2d944ab4894f Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 18 Jul 2023 10:02:53 -0400 Subject: [PATCH] feat: daemon: import: only setup stmgr if validating chain --- cmd/lotus/daemon.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index e58da78d1e1..043d1054729 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -571,17 +571,17 @@ func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool) return err } - shd, err := drand.BeaconScheduleFromDrandSchedule(build.DrandConfigSchedule(), gb.MinTimestamp(), nil) - if err != nil { - return xerrors.Errorf("failed to construct beacon schedule: %w", err) - } + if !snapshot { + shd, err := drand.BeaconScheduleFromDrandSchedule(build.DrandConfigSchedule(), gb.MinTimestamp(), nil) + if err != nil { + return xerrors.Errorf("failed to construct beacon schedule: %w", err) + } - stm, err := stmgr.NewStateManager(cst, consensus.NewTipSetExecutor(filcns.RewardFunc), vm.Syscalls(ffiwrapper.ProofVerifier), filcns.DefaultUpgradeSchedule(), shd, mds, index.DummyMsgIndex) - if err != nil { - return err - } + stm, err := stmgr.NewStateManager(cst, consensus.NewTipSetExecutor(filcns.RewardFunc), vm.Syscalls(ffiwrapper.ProofVerifier), filcns.DefaultUpgradeSchedule(), shd, mds, index.DummyMsgIndex) + if err != nil { + return err + } - if !snapshot { log.Infof("validating imported chain...") if err := stm.ValidateChain(ctx, ts); err != nil { return xerrors.Errorf("chain validation failed: %w", err)