2021-01-26 20:46:57 +00:00
|
|
|
package modules
|
|
|
|
|
|
|
|
import (
|
2021-07-27 13:30:23 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/vm"
|
2021-01-26 20:46:57 +00:00
|
|
|
"go.uber.org/fx"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
|
|
|
"github.com/filecoin-project/lotus/chain/store"
|
|
|
|
)
|
|
|
|
|
2021-09-02 16:07:23 +00:00
|
|
|
func StateManager(lc fx.Lifecycle, cs *store.ChainStore, exec stmgr.Executor, sys vm.SyscallBuilder, us stmgr.UpgradeSchedule) (*stmgr.StateManager, error) {
|
|
|
|
sm, err := stmgr.NewStateManager(cs, exec, sys, us)
|
2021-01-26 20:46:57 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
lc.Append(fx.Hook{
|
|
|
|
OnStart: sm.Start,
|
|
|
|
OnStop: sm.Stop,
|
|
|
|
})
|
|
|
|
return sm, nil
|
|
|
|
}
|