2023-10-25 12:23:25 +00:00
|
|
|
package provider
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-10-27 23:08:18 +00:00
|
|
|
"time"
|
|
|
|
|
2023-10-25 19:13:56 +00:00
|
|
|
logging "github.com/ipfs/go-log/v2"
|
|
|
|
|
2023-10-25 12:23:25 +00:00
|
|
|
"github.com/filecoin-project/lotus/api"
|
|
|
|
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
|
|
|
|
"github.com/filecoin-project/lotus/node/config"
|
|
|
|
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
|
2023-10-25 18:58:16 +00:00
|
|
|
"github.com/filecoin-project/lotus/provider/chainsched"
|
2023-10-25 12:23:25 +00:00
|
|
|
"github.com/filecoin-project/lotus/provider/lpwindow"
|
|
|
|
"github.com/filecoin-project/lotus/storage/ctladdr"
|
2023-11-06 22:10:57 +00:00
|
|
|
"github.com/filecoin-project/lotus/storage/paths"
|
|
|
|
"github.com/filecoin-project/lotus/storage/sealer"
|
2023-10-25 12:23:25 +00:00
|
|
|
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
|
|
|
)
|
|
|
|
|
2023-10-25 18:58:16 +00:00
|
|
|
var log = logging.Logger("provider")
|
|
|
|
|
2023-10-25 12:23:25 +00:00
|
|
|
func WindowPostScheduler(ctx context.Context, fc config.LotusProviderFees, pc config.ProvingConfig,
|
2023-10-27 14:10:55 +00:00
|
|
|
api api.FullNode, verif storiface.Verifier, lw *sealer.LocalWorker,
|
2023-10-27 23:08:18 +00:00
|
|
|
as *ctladdr.AddressSelector, maddr []dtypes.MinerAddress, db *harmonydb.DB, stor paths.Store, idx paths.SectorIndex, max int) (*lpwindow.WdPostTask, error) {
|
2023-10-25 12:23:25 +00:00
|
|
|
|
2023-10-25 18:58:16 +00:00
|
|
|
chainSched := chainsched.New(api)
|
2023-10-25 12:23:25 +00:00
|
|
|
|
2023-10-27 14:10:55 +00:00
|
|
|
// todo config
|
|
|
|
ft := lpwindow.NewSimpleFaultTracker(stor, idx, 32, 5*time.Second, 300*time.Second)
|
|
|
|
|
2023-10-30 18:40:06 +00:00
|
|
|
task, err := lpwindow.NewWdPostTask(db, api, ft, lw, verif, chainSched, maddr, max)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
go chainSched.Run(ctx)
|
|
|
|
|
|
|
|
return task, nil
|
2023-10-25 12:23:25 +00:00
|
|
|
}
|