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

View File

@ -54,7 +54,7 @@ var MinerNode = Options(
// builtin actors manifest // builtin actors manifest
Override(new(dtypes.BuiltinActorsLoaded), modules.LoadBultinActors), Override(new(dtypes.BuiltinActorsLoaded), modules.LoadBultinActors),
Override(new(dtypes.UniversalBlockstore), modules.UniversalBlockstore), Override(new(dtypes.UniversalBlockstore), modules.MemoryBlockstore),
) )
func ConfigStorageMiner(c interface{}) Option { 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 return bs, err
} }
func MemoryBlockstore() dtypes.UniversalBlockstore {
return blockstore.NewMemory()
}
func DiscardColdBlockstore(lc fx.Lifecycle, bs dtypes.UniversalBlockstore) (dtypes.ColdBlockstore, error) { func DiscardColdBlockstore(lc fx.Lifecycle, bs dtypes.UniversalBlockstore) (dtypes.ColdBlockstore, error) {
return blockstore.NewDiscardStore(bs), nil return blockstore.NewDiscardStore(bs), nil
} }