Skip to content

Commit

Permalink
Merge pull request #6763 from filecoin-project/johnli-helloworld-fix/…
Browse files Browse the repository at this point in the history
…fsm-error

sealing: Handle preCommitParams errors more correctly
  • Loading branch information
magik6k authored Jul 21, 2021
2 parents 0236f2e + 8029a9f commit 90c8891
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extern/storage-sealing/states_sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,11 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
}

params, pcd, tok, err := m.preCommitParams(ctx, sector)
if params == nil || err != nil {
return err
if err != nil {
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)})
}
if params == nil {
return nil // event was sent in preCommitParams
}

deposit, err := collateralSendAmount(ctx.Context(), m.api, m.maddr, cfg, pcd)
Expand Down Expand Up @@ -403,9 +406,12 @@ func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector Se
}

params, deposit, _, err := m.preCommitParams(ctx, sector)
if params == nil || err != nil {
if err != nil {
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)})
}
if params == nil {
return nil // event was sent in preCommitParams
}

res, err := m.precommiter.AddPreCommit(ctx.Context(), sector, deposit, params)
if err != nil {
Expand Down

0 comments on commit 90c8891

Please sign in to comment.