diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index 3f3336b9a..2178ce0b4 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -321,11 +321,6 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) return nil } - collateral, err := m.api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, *sector.PreCommitInfo, tok) - if err != nil { - return xerrors.Errorf("getting initial pledge collateral: %w", err) - } - pci, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok) if err != nil { return xerrors.Errorf("getting precommit info: %w", err) @@ -334,6 +329,11 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) return ctx.Send(SectorCommitFailed{error: xerrors.Errorf("precommit info not found on chain")}) } + collateral, err := m.api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, pci.Info, tok) + if err != nil { + return xerrors.Errorf("getting initial pledge collateral: %w", err) + } + collateral = big.Sub(collateral, pci.PreCommitDeposit) if collateral.LessThan(big.Zero()) { collateral = big.Zero()