lotus/node/modules/stmgr.go

25 lines
779 B
Go
Raw Normal View History

package modules
import (
"go.uber.org/fx"
2022-06-14 15:00:51 +00:00
"github.com/filecoin-project/lotus/chain/beacon"
2023-03-12 13:25:07 +00:00
"github.com/filecoin-project/lotus/chain/index"
"github.com/filecoin-project/lotus/chain/stmgr"
"github.com/filecoin-project/lotus/chain/store"
2022-06-14 15:00:51 +00:00
"github.com/filecoin-project/lotus/chain/vm"
2023-02-27 17:27:48 +00:00
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
2023-03-12 13:25:07 +00:00
func StateManager(lc fx.Lifecycle, cs *store.ChainStore, exec stmgr.Executor, sys vm.SyscallBuilder, us stmgr.UpgradeSchedule, b beacon.Schedule, metadataDs dtypes.MetadataDS, msgIndex index.MsgIndex) (*stmgr.StateManager, error) {
sm, err := stmgr.NewStateManager(cs, exec, sys, us, b, metadataDs, msgIndex)
if err != nil {
return nil, err
}
lc.Append(fx.Hook{
OnStart: sm.Start,
OnStop: sm.Stop,
})
return sm, nil
}