diff --git a/core/commands/pin.go b/core/commands/pin.go index 4a43275e47e8..24cc1618f1bd 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -10,7 +10,7 @@ import ( context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" core "github.com/ipfs/go-ipfs/core" corerepo "github.com/ipfs/go-ipfs/core/corerepo" - dag "github.com/ipfs/go-ipfs/merkledag" + gc "github.com/ipfs/go-ipfs/pin/gc" path "github.com/ipfs/go-ipfs/path" u "github.com/ipfs/go-ipfs/util" ) @@ -327,15 +327,9 @@ func pinLsAll(typeStr string, ctx context.Context, n *core.IpfsNode) (map[string } if typeStr == "indirect" || typeStr == "all" { ks := key.NewKeySet() - for _, k := range n.Pinning.RecursiveKeys() { - nd, err := n.DAG.Get(ctx, k) - if err != nil { - return nil, err - } - err = dag.EnumerateChildren(n.Context(), n.DAG, nd, ks) - if err != nil { - return nil, err - } + err := gc.Descendants(n.DAG, ks, n.Pinning.RecursiveKeys()) + if err != nil { + return nil, err } AddToResultKeys(ks.Keys(), "indirect") }