Skip to content

Commit

Permalink
fix: replace SelectiveCar prepare+dump with write for CommP
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Feb 16, 2023
1 parent a96e387 commit b2b5e42
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions storagemarket/impl/clientutils/clientutils.go
Expand Up @@ -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()
Expand Down

0 comments on commit b2b5e42

Please sign in to comment.