fsm: Fix panic on missing precommit info
This commit is contained in:
parent
29db7047a3
commit
a66e202f02
10
extern/storage-sealing/states_sealing.go
vendored
10
extern/storage-sealing/states_sealing.go
vendored
@ -321,11 +321,6 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
|
|||||||
return nil
|
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)
|
pci, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getting precommit info: %w", err)
|
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")})
|
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)
|
collateral = big.Sub(collateral, pci.PreCommitDeposit)
|
||||||
if collateral.LessThan(big.Zero()) {
|
if collateral.LessThan(big.Zero()) {
|
||||||
collateral = big.Zero()
|
collateral = big.Zero()
|
||||||
|
Loading…
Reference in New Issue
Block a user