lotus/chain/stmgr/forks.go

26 lines
571 B
Go
Raw Normal View History

2019-12-19 18:46:30 +00:00
package stmgr
import (
"context"
2020-02-08 02:18:32 +00:00
"github.com/filecoin-project/specs-actors/actors/abi"
2019-12-20 09:51:13 +00:00
"github.com/ipfs/go-cid"
2019-12-19 18:46:30 +00:00
)
2020-02-08 02:18:32 +00:00
var ForksAtHeight = map[abi.ChainEpoch]func(context.Context, *StateManager, cid.Cid) (cid.Cid, error){}
2020-02-08 02:18:32 +00:00
func (sm *StateManager) handleStateForks(ctx context.Context, pstate cid.Cid, height, parentH abi.ChainEpoch) (_ cid.Cid, err error) {
for i := parentH; i < height; i++ {
f, ok := ForksAtHeight[i]
if ok {
nstate, err := f(ctx, sm, pstate)
if err != nil {
return cid.Undef, err
}
pstate = nstate
}
2019-12-19 18:46:30 +00:00
}
return pstate, nil
2019-12-19 18:46:30 +00:00
}