diff --git a/chain/actors/manifest.go b/chain/actors/manifest.go index 97c9b7d6c..f9932d1db 100644 --- a/chain/actors/manifest.go +++ b/chain/actors/manifest.go @@ -126,3 +126,12 @@ func LoadBundle(ctx context.Context, bs blockstore.Blockstore, av Version, data return nil } + +func LoadManifestFromBundle(ctx context.Context, bs blockstore.Blockstore, av Version, data []byte) error { + if err := LoadBundle(ctx, bs, av, data); err != nil { + return err + } + + cborStore := cbor.NewCborStore(bs) + return LoadManifests(ctx, cborStore) +} diff --git a/cmd/lotus-miner/init.go b/cmd/lotus-miner/init.go index ead430e30..abda9df26 100644 --- a/cmd/lotus-miner/init.go +++ b/cmd/lotus-miner/init.go @@ -21,7 +21,6 @@ import ( "github.com/google/uuid" "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/namespace" - cbor "github.com/ipfs/go-ipld-cbor" "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/peer" "github.com/mitchellh/go-homedir" @@ -220,13 +219,8 @@ var initCmd = &cli.Command{ if len(build.BuiltinActorsV8Bundle()) > 0 { bs := blockstore.NewMemory() - if err := actors.LoadBundle(context.TODO(), bs, actors.Version8, build.BuiltinActorsV8Bundle()); err != nil { - return xerrors.Errorf("error loading actor bundle: %w", err) - } - - cborStore := cbor.NewCborStore(bs) - if err := actors.LoadManifests(ctx, cborStore); err != nil { - return xerrors.Errorf("error loading actor manifests: %w", err) + if err := actors.LoadManifestFromBundle(context.TODO(), bs, actors.Version8, build.BuiltinActorsV8Bundle()); err != nil { + return xerrors.Errorf("error loading actor manifest: %w", err) } }