From b2b5e42261cb10ed99fd00e1bca18a06f862f382 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Thu, 21 Oct 2021 11:14:47 +1100 Subject: [PATCH] fix: replace SelectiveCar prepare+dump with write for CommP --- storagemarket/impl/clientutils/clientutils.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/storagemarket/impl/clientutils/clientutils.go b/storagemarket/impl/clientutils/clientutils.go index a99b4228..8e859820 100644 --- a/storagemarket/impl/clientutils/clientutils.go +++ b/storagemarket/impl/clientutils/clientutils.go @@ -53,15 +53,8 @@ func CommP(ctx context.Context, bs bstore.Blockstore, data *storagemarket.DataRe // do a CARv1 traversal with the DFS selector. sc := car.NewSelectiveCar(ctx, bs, []car.Dag{{Root: data.Root, Selector: selectorparse.CommonSelector_ExploreAllRecursively}}, car.MaxTraversalLinks(maxTraversalLinks)) - prepared, err := sc.Prepare() - if err != nil { - return cid.Undef, 0, xerrors.Errorf("failed to prepare CAR: %w", err) - } - - // write out the deterministic CARv1 payload to the CommP writer and calculate the CommP. commpWriter := &writer.Writer{} - err = prepared.Dump(ctx, commpWriter) - if err != nil { + if err := sc.Write(commpWriter); err != nil { return cid.Undef, 0, xerrors.Errorf("failed to write CARv1 to commP writer: %w", err) } dataCIDSize, err := commpWriter.Sum()