diff --git a/storage/sealer/mock/mock.go b/storage/sealer/mock/mock.go index baa644cc1..5b0afd35c 100644 --- a/storage/sealer/mock/mock.go +++ b/storage/sealer/mock/mock.go @@ -439,6 +439,9 @@ func (mgr *SectorMgr) GenerateWindowPoStWithVanilla(ctx context.Context, proofTy func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) { off := storiface.UnpaddedByteIndex(0) var piece cid.Cid + + mgr.lk.Lock() + for _, c := range mgr.sectors[sector.ID].pieces { piece = c if off >= offset { @@ -451,6 +454,8 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef, } br := bytes.NewReader(mgr.pieces[piece][:size]) + mgr.lk.Unlock() + return struct { io.ReadCloser io.Seeker