diff --git a/state.go b/state.go index 644a26b..bc6e39d 100644 --- a/state.go +++ b/state.go @@ -4,6 +4,9 @@ import ( "bytes" "context" "fmt" + actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" + "github.com/filecoin-project/lotus/chain/actors" "sync" "sync/atomic" @@ -202,6 +205,18 @@ func enumInit(ctx context.Context, bg *blockGetter, ts *lchtypes.TipSet, initFun return err } + if name, av, ok := actors.GetActorMetaByCode(initActor.Code); ok { + if name != manifest.InitKey { + return xerrors.Errorf("actor code is not init: %s", name) + } + + if av != actorstypes.Version13 { + return xerrors.Errorf( + "the application is out of date with the network, please update to a later version," + + " or if this is the latest version file an issue to update the init actor version") + } + } + var initRoot _init13.State // Try loading as a new-style state-tree (version/actors tuple). if err := ast.Get(ctx, initActor.Head, &initRoot); err != nil {