From 97c2cdb8d616b8fe617981aae3a2d6edcf77eccb Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sat, 2 Oct 2021 13:32:20 +1000 Subject: [PATCH] traversals: limit link load count for SelectiveCar use as well --- node/impl/client/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 5f08f93cb..7ed0a683c 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -54,6 +54,7 @@ import ( "github.com/filecoin-project/specs-actors/v3/actors/builtin/market" marketevents "github.com/filecoin-project/lotus/markets/loggers" + "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/repo/imports" "github.com/filecoin-project/lotus/api" @@ -981,6 +982,7 @@ func (a *API) clientRetrieve(ctx context.Context, order api.RetrievalOrder, ref Root: order.Root, Selector: sel, }}, + car.MaxTraversalLinks(config.MaxTraversalLinks), ).Write(f) if err != nil { finish(err) @@ -1232,7 +1234,11 @@ func (a *API) ClientGenCar(ctx context.Context, ref api.FileRef, outputPath stri allSelector := ssb.ExploreRecursive( selector.RecursionLimitNone(), ssb.ExploreAll(ssb.ExploreRecursiveEdge())).Node() - sc := car.NewSelectiveCar(ctx, fs, []car.Dag{{Root: root, Selector: allSelector}}) + sc := car.NewSelectiveCar(ctx, + fs, + []car.Dag{{Root: root, Selector: allSelector}}, + car.MaxTraversalLinks(config.MaxTraversalLinks), + ) f, err := os.Create(outputPath) if err != nil { return err