From 9fd69377dfc611032e03a9e64dcf07ea6997b2f7 Mon Sep 17 00:00:00 2001 From: Phi Date: Mon, 10 Apr 2023 09:53:19 +0200 Subject: [PATCH] fix: unseal: check if sealed sector exists Check if sealed or update sector exists when `SectorsUnsealPiece` is called. --- storage/sealer/manager.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/storage/sealer/manager.go b/storage/sealer/manager.go index db5f9a589..3f496b7de 100644 --- a/storage/sealer/manager.go +++ b/storage/sealer/manager.go @@ -319,6 +319,15 @@ func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storiface.Secto return xerrors.Errorf("acquiring unseal sector lock: %w", err) } + // Check if sealed or update sector file exists + s, err := m.index.StorageFindSector(ctx, sector.ID, storiface.FTSealed|storiface.FTUpdate, 0, false) + if err != nil { + return xerrors.Errorf("finding sealed or updated sector: %w", err) + } + if len(s) == 0 { + return xerrors.Errorf("sealed or updated sector file not found for sector %d", sector.ID) + } + // if the selected worker does NOT have the sealed files for the sector, instruct it to fetch it from a worker that has them and // put it in the sealing scratch space. sealFetch := PrepareAction{