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 Oct 21, 2021
1 parent 0055f41 commit 3ad1ed3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions storagemarket/impl/clientutils/clientutils.go
Expand Up @@ -52,14 +52,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(commpWriter)
err := sc.Write(commpWriter)
if err != nil {
return cid.Undef, 0, xerrors.Errorf("failed to write CARv1 to commP writer: %w", err)
}
Expand Down

0 comments on commit 3ad1ed3

Please sign in to comment.