From 055bbc3ab1e5442e792927d709c549b404199ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 12 Aug 2024 12:56:30 +0200 Subject: [PATCH] fix unsealed handling in snapdeals --- lib/ffi/snap_funcs.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ffi/snap_funcs.go b/lib/ffi/snap_funcs.go index cd8292851..e615aed1f 100644 --- a/lib/ffi/snap_funcs.go +++ b/lib/ffi/snap_funcs.go @@ -36,7 +36,7 @@ func (sb *SealCalls) EncodeUpdate( pieces []abi.PieceInfo, keepUnsealed bool) (sealedCID cid.Cid, unsealedCID cid.Cid, err error) { noDecl := storiface.FTNone - if keepUnsealed { + if !keepUnsealed { noDecl = storiface.FTUnsealed } @@ -251,7 +251,12 @@ func (sb *SealCalls) EncodeUpdate( return cid.Undef, cid.Undef, xerrors.Errorf("clear cache: %w", err) } - if err := sb.ensureOneCopy(ctx, sector.ID, pathIDs, storiface.FTUpdate|storiface.FTUpdateCache); err != nil { + ensureTypes := storiface.FTUpdate | storiface.FTUpdateCache + if keepUnsealed { + ensureTypes |= storiface.FTUnsealed + } + + if err := sb.ensureOneCopy(ctx, sector.ID, pathIDs, ensureTypes); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("ensure one copy: %w", err) }