add LoadManifestFromBundle, use it in miner init

This commit is contained in:
vyzo 2022-04-15 20:15:28 +03:00
parent 534e43e1d3
commit beb3369c76
2 changed files with 11 additions and 8 deletions

View File

@ -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)
}

View File

@ -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)
}
}