v1.27.0-a #10
@ -80,7 +80,7 @@ func StartTasks(ctx context.Context, dependencies *deps.Deps) (*harmonytask.Task
|
|||||||
activeTasks = append(activeTasks, treesTask)
|
activeTasks = append(activeTasks, treesTask)
|
||||||
}
|
}
|
||||||
if cfg.Subsystems.EnableSendPrecommitMsg {
|
if cfg.Subsystems.EnableSendPrecommitMsg {
|
||||||
precommitTask := lpseal.NewSubmitPrecommitTask(sp, db, full, sender, cfg.Fees.MaxPreCommitGasFee)
|
precommitTask := lpseal.NewSubmitPrecommitTask(sp, db, full, sender, as, cfg.Fees.MaxPreCommitGasFee)
|
||||||
activeTasks = append(activeTasks, precommitTask)
|
activeTasks = append(activeTasks, precommitTask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,16 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
"github.com/filecoin-project/lotus/lib/harmony/harmonytask"
|
||||||
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
"github.com/filecoin-project/lotus/lib/harmony/resources"
|
||||||
"github.com/filecoin-project/lotus/provider/lpmessage"
|
"github.com/filecoin-project/lotus/provider/lpmessage"
|
||||||
|
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||||
|
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SubmitPrecommitTaskApi interface {
|
type SubmitPrecommitTaskApi interface {
|
||||||
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
|
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
|
||||||
|
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
|
||||||
|
ctladdr.NodeApi
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubmitPrecommitTask struct {
|
type SubmitPrecommitTask struct {
|
||||||
@ -28,16 +32,18 @@ type SubmitPrecommitTask struct {
|
|||||||
db *harmonydb.DB
|
db *harmonydb.DB
|
||||||
api SubmitPrecommitTaskApi
|
api SubmitPrecommitTaskApi
|
||||||
sender *lpmessage.Sender
|
sender *lpmessage.Sender
|
||||||
|
as sealing.AddressSelector
|
||||||
|
|
||||||
maxFee types.FIL
|
maxFee types.FIL
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSubmitPrecommitTask(sp *SealPoller, db *harmonydb.DB, api SubmitPrecommitTaskApi, sender *lpmessage.Sender, maxFee types.FIL) *SubmitPrecommitTask {
|
func NewSubmitPrecommitTask(sp *SealPoller, db *harmonydb.DB, api SubmitPrecommitTaskApi, sender *lpmessage.Sender, as sealing.AddressSelector, maxFee types.FIL) *SubmitPrecommitTask {
|
||||||
return &SubmitPrecommitTask{
|
return &SubmitPrecommitTask{
|
||||||
sp: sp,
|
sp: sp,
|
||||||
db: db,
|
db: db,
|
||||||
api: api,
|
api: api,
|
||||||
sender: sender,
|
sender: sender,
|
||||||
|
as: as,
|
||||||
|
|
||||||
maxFee: maxFee,
|
maxFee: maxFee,
|
||||||
}
|
}
|
||||||
@ -51,8 +57,8 @@ func (s *SubmitPrecommitTask) Do(taskID harmonytask.TaskID, stillOwned func() bo
|
|||||||
SectorNumber int64 `db:"sector_number"`
|
SectorNumber int64 `db:"sector_number"`
|
||||||
RegSealProof abi.RegisteredSealProof `db:"reg_seal_proof"`
|
RegSealProof abi.RegisteredSealProof `db:"reg_seal_proof"`
|
||||||
TicketEpoch abi.ChainEpoch `db:"ticket_epoch"`
|
TicketEpoch abi.ChainEpoch `db:"ticket_epoch"`
|
||||||
SealedCID string `db:"sealed_cid"`
|
SealedCID string `db:"tree_r_cid"`
|
||||||
UnsealedCID string `db:"unsealed_cid"`
|
UnsealedCID string `db:"tree_d_cid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.db.Select(ctx, §orParamsArr, `
|
err = s.db.Select(ctx, §orParamsArr, `
|
||||||
@ -107,8 +113,19 @@ func (s *SubmitPrecommitTask) Do(taskID harmonytask.TaskID, stillOwned func() bo
|
|||||||
return false, xerrors.Errorf("getting precommit deposit: %w", err)
|
return false, xerrors.Errorf("getting precommit deposit: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mi, err := s.api.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||||
|
if err != nil {
|
||||||
|
return false, xerrors.Errorf("getting miner info: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
a, _, err := s.as.AddressFor(ctx, s.api, mi, api.PreCommitAddr, collateral, big.Zero())
|
||||||
|
if err != nil {
|
||||||
|
return false, xerrors.Errorf("getting address for precommit: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
msg := &types.Message{
|
msg := &types.Message{
|
||||||
To: maddr,
|
To: maddr,
|
||||||
|
From: a,
|
||||||
Method: builtin.MethodsMiner.PreCommitSectorBatch2,
|
Method: builtin.MethodsMiner.PreCommitSectorBatch2,
|
||||||
Params: pbuf.Bytes(),
|
Params: pbuf.Bytes(),
|
||||||
Value: collateral, // todo config for pulling from miner balance!!
|
Value: collateral, // todo config for pulling from miner balance!!
|
||||||
|
Loading…
Reference in New Issue
Block a user