Calculate depositMinimum for upgrading as replaced sector's Initialpledge

This commit is contained in:
Aayush Rajasekaran 2020-08-18 18:55:18 -04:00
parent 98f00b510f
commit 7de7e65dbc
2 changed files with 6 additions and 6 deletions

View File

@ -205,7 +205,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit)
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.PreCommitSector, deposit, m.feeCfg.MaxPreCommitGasFee, enc.Bytes())
if err != nil {
if params.ReplaceSectorDeadline > 0 {
if params.ReplaceCapacity {
m.remarkForUpgrade(params.ReplaceSectorNumber)
}
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})

View File

@ -57,18 +57,18 @@ func (m *Sealing) tryUpgradeSector(ctx context.Context, params *miner.SectorPreC
params.ReplaceSectorDeadline = loc.Deadline
params.ReplaceSectorPartition = loc.Partition
ri, err := m.GetSectorInfo(*replace)
ri, err := m.api.StateSectorGetInfo(ctx, m.maddr, *replace, nil)
if err != nil {
log.Errorf("error calling GetSectorInfo for replaced sector: %+v", err)
log.Errorf("error calling StateSectorGetInfo for replaced sector: %+v", err)
return big.Zero()
}
if params.Expiration < ri.PreCommitInfo.Expiration {
if params.Expiration < ri.Expiration {
// TODO: Some limit on this
params.Expiration = ri.PreCommitInfo.Expiration
params.Expiration = ri.Expiration
}
return ri.PreCommitDeposit
return ri.InitialPledge
}
return big.Zero()