use memory blockstore for miner manifest loading

This commit is contained in:
vyzo 2022-04-14 19:02:19 +03:00
parent 507b835a9c
commit 6bd2d89e30
3 changed files with 7 additions and 5 deletions

View File

@ -45,6 +45,7 @@ import (
lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/api/v1api"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -217,10 +218,7 @@ var initCmd = &cli.Command{
}
if len(build.BuiltinActorsV8Bundle()) > 0 {
bs, err := lr.Blockstore(context.TODO(), repo.UniversalBlockstore)
if err != nil {
return xerrors.Errorf("error opening blockstore: %w", err)
}
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)

View File

@ -54,7 +54,7 @@ var MinerNode = Options(
// builtin actors manifest
Override(new(dtypes.BuiltinActorsLoaded), modules.LoadBultinActors),
Override(new(dtypes.UniversalBlockstore), modules.UniversalBlockstore),
Override(new(dtypes.UniversalBlockstore), modules.MemoryBlockstore),
)
func ConfigStorageMiner(c interface{}) Option {

View File

@ -37,6 +37,10 @@ func UniversalBlockstore(lc fx.Lifecycle, mctx helpers.MetricsCtx, r repo.Locked
return bs, err
}
func MemoryBlockstore() dtypes.UniversalBlockstore {
return blockstore.NewMemory()
}
func DiscardColdBlockstore(lc fx.Lifecycle, bs dtypes.UniversalBlockstore) (dtypes.ColdBlockstore, error) {
return blockstore.NewDiscardStore(bs), nil
}