diff --git a/node/builder.go b/node/builder.go index 4a17ef7bf..06508eacf 100644 --- a/node/builder.go +++ b/node/builder.go @@ -56,6 +56,8 @@ import ( "github.com/filecoin-project/lotus/paychmgr" "github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage/sealing" + "github.com/filecoin-project/lotus/storage/sealmgr" + "github.com/filecoin-project/lotus/storage/sealmgr/advmgr" "github.com/filecoin-project/lotus/storage/sectorblocks" ) @@ -253,6 +255,13 @@ func Online() Option { // Storage miner ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner }, + Override(new(*sectorbuilder.Config), modules.SectorBuilderConfig), + Override(new(advmgr.LocalStorage), From(new(repo.LockedRepo))), + Override(new(*advmgr.Manager), advmgr.New), + + Override(new(sealmgr.Manager), From(new(*advmgr.Manager))), + Override(new(sectorbuilder.Prover), From(new(sealmgr.Manager))), + Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks), Override(new(sealing.TicketFn), modules.SealTicketGen), Override(new(*storage.Miner), modules.StorageMiner), diff --git a/node/options.go b/node/options.go index 75a57cb9b..a99dc5bbc 100644 --- a/node/options.go +++ b/node/options.go @@ -84,6 +84,15 @@ func Unset(typ interface{}) Option { } } +// From(*T) -> func(t T) T {return t} +func From(typ interface{}) interface{} { + rt := []reflect.Type{reflect.TypeOf(typ).Elem()} + ft := reflect.FuncOf(rt, rt, false) + return reflect.MakeFunc(ft, func(args []reflect.Value) (results []reflect.Value) { + return args + }).Interface() +} + // from go-ipfs // as casts input constructor to a given interface (if a value is given, it // wraps it into a constructor).