From f3bea4aa8bd731833f26fac39933d206faf9813e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 23 Apr 2020 13:42:51 +0200 Subject: [PATCH] Set pledge collateral in commit message --- sealing.go | 1 + states.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sealing.go b/sealing.go index 1fce17a73..88a2c3313 100644 --- a/sealing.go +++ b/sealing.go @@ -33,6 +33,7 @@ type SealingAPI interface { StateMinerSectorSize(context.Context, address.Address, TipSetToken) (abi.SectorSize, error) StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok TipSetToken) (address.Address, error) StateMinerDeadlines(ctx context.Context, maddr address.Address, tok TipSetToken) (*miner.Deadlines, error) + StateMinerInitialPledgeCollateral(context.Context, address.Address, abi.SectorNumber, TipSetToken) (big.Int, error) StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (market.DealProposal, market.DealState, error) SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, gasPrice big.Int, gasLimit int64, params []byte) (cid.Cid, error) ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error) diff --git a/states.go b/states.go index 7fcf909d9..c092059b8 100644 --- a/states.go +++ b/states.go @@ -256,8 +256,13 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) return nil } + collateral, err := m.api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, sector.SectorNumber, tok) + if err != nil { + return xerrors.Errorf("getting initial pledge collateral: %w", err) + } + // TODO: check seed / ticket are up to date - mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.ProveCommitSector, big.NewInt(0), big.NewInt(1), 1000000, enc.Bytes()) + mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.ProveCommitSector, collateral, big.NewInt(1), 1000000, enc.Bytes()) if err != nil { return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) }