lotus/provider/builder.go

47 lines
1.8 KiB
Go
Raw Normal View History

package provider
import (
"context"
2023-10-27 23:08:18 +00:00
"time"
"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-11-04 10:04:46 +00:00
"github.com/filecoin-project/lotus/provider/lpmessage"
"github.com/filecoin-project/lotus/provider/lpwindow"
2024-02-13 01:03:45 +00:00
"github.com/filecoin-project/lotus/provider/multictladdr"
2023-11-04 10:04:46 +00:00
"github.com/filecoin-project/lotus/storage/paths"
"github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
)
2023-11-25 15:15:09 +00:00
//var log = logging.Logger("provider")
2023-10-25 18:58:16 +00:00
func WindowPostScheduler(ctx context.Context, fc config.LotusProviderFees, pc config.ProvingConfig,
2024-01-05 15:10:34 +00:00
api api.FullNode, verif storiface.Verifier, lw *sealer.LocalWorker, sender *lpmessage.Sender, chainSched *chainsched.ProviderChainSched,
2024-02-13 01:03:45 +00:00
as *multictladdr.MultiAddressSelector, addresses map[dtypes.MinerAddress]bool, db *harmonydb.DB,
2023-11-09 16:32:32 +00:00
stor paths.Store, idx paths.SectorIndex, max int) (*lpwindow.WdPostTask, *lpwindow.WdPostSubmitTask, *lpwindow.WdPostRecoverDeclareTask, error) {
2023-10-27 14:10:55 +00:00
// todo config
ft := lpwindow.NewSimpleFaultTracker(stor, idx, pc.ParallelCheckLimit, time.Duration(pc.SingleCheckTimeout), time.Duration(pc.PartitionCheckTimeout))
2023-10-27 14:10:55 +00:00
2023-11-09 16:32:32 +00:00
computeTask, err := lpwindow.NewWdPostTask(db, api, ft, lw, verif, chainSched, addresses, max)
2023-11-03 21:40:28 +00:00
if err != nil {
2023-11-09 16:32:32 +00:00
return nil, nil, nil, err
2023-11-03 21:40:28 +00:00
}
submitTask, err := lpwindow.NewWdPostSubmitTask(chainSched, sender, db, api, fc.MaxWindowPoStGasFee, as)
if err != nil {
2023-11-09 16:32:32 +00:00
return nil, nil, nil, err
}
recoverTask, err := lpwindow.NewWdPostRecoverDeclareTask(sender, db, api, ft, as, chainSched, fc.MaxWindowPoStGasFee, addresses)
if err != nil {
return nil, nil, nil, err
}
2023-11-09 16:32:32 +00:00
return computeTask, submitTask, recoverTask, nil
}