lotus/chain/stmgr/forks.go

25 lines
500 B
Go
Raw Normal View History

2019-12-19 18:46:30 +00:00
package stmgr
import (
"context"
2019-12-20 09:51:13 +00:00
"github.com/ipfs/go-cid"
2019-12-19 18:46:30 +00:00
)
var ForksAtHeight = map[uint64]func(context.Context, *StateManager, cid.Cid) (cid.Cid, error){}
func (sm *StateManager) handleStateForks(ctx context.Context, pstate cid.Cid, height, parentH uint64) (_ 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
}