From aea338ecf0c670bc8b17ad6b9c035106329088cd Mon Sep 17 00:00:00 2001 From: johnli-helloworld Date: Thu, 24 Jun 2021 11:35:15 +0800 Subject: [PATCH 1/2] fix handleSubmitPreCommitBatch() preCommitParams error --- extern/storage-sealing/states_sealing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index 4a94fb02e21..a9661bd1463 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -404,7 +404,7 @@ func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector Se params, deposit, _, err := m.preCommitParams(ctx, sector) if params == nil || err != nil { - return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)}) + return err } res, err := m.precommiter.AddPreCommit(ctx.Context(), sector, deposit, params) From 8029a9ffe351ce96d04f70fc07de661aa7e7d0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 15 Jul 2021 13:42:07 +0200 Subject: [PATCH 2/2] sealing: Address riview on preCommitParams send fix --- extern/storage-sealing/states_sealing.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index a9661bd1463..5334fc72e74 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -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) @@ -403,8 +406,11 @@ func (m *Sealing) handleSubmitPreCommitBatch(ctx statemachine.Context, sector Se } params, deposit, _, 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 } res, err := m.precommiter.AddPreCommit(ctx.Context(), sector, deposit, params)