2019-12-19 18:46:30 +00:00
|
|
|
package stmgr
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-07-28 12:31:13 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2020-02-08 02:18:32 +00:00
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
2019-12-19 18:46:30 +00:00
|
|
|
)
|
|
|
|
|
2020-07-28 12:31:13 +00:00
|
|
|
var ForksAtHeight = map[abi.ChainEpoch]func(context.Context, *StateManager, types.StateTree) error{}
|
2020-01-31 23:51:15 +00:00
|
|
|
|
2020-07-28 12:31:13 +00:00
|
|
|
func (sm *StateManager) handleStateForks(ctx context.Context, st types.StateTree, height abi.ChainEpoch) (err error) {
|
|
|
|
f, ok := ForksAtHeight[height]
|
|
|
|
if ok {
|
|
|
|
err := f(ctx, sm, st)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2019-12-19 20:00:59 +00:00
|
|
|
}
|
2019-12-19 18:46:30 +00:00
|
|
|
}
|
2019-12-19 20:00:59 +00:00
|
|
|
|
2020-07-28 12:31:13 +00:00
|
|
|
return nil
|
2019-12-19 18:46:30 +00:00
|
|
|
}
|