2021-01-26 20:46:57 +00:00
|
|
|
package modules
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.uber.org/fx"
|
|
|
|
|
2022-06-14 15:00:51 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/beacon"
|
2021-01-26 20:46:57 +00:00
|
|
|
"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"
|
2021-01-26 20:46:57 +00:00
|
|
|
)
|
|
|
|
|
2023-02-27 17:27:48 +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) (*stmgr.StateManager, error) {
|
|
|
|
sm, err := stmgr.NewStateManager(cs, exec, sys, us, b, metadataDs)
|
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
|
|
|
|
}
|