提交 ac054f3d 作者: Hector Sanjuan

Issue #3419: Do not recursively resolve DAG just to obtain a CID

License: MIT
Signed-off-by: 's avatarHector Sanjuan <code@hector.link>
上级 ccb46fa9
......@@ -269,6 +269,11 @@ type RefKeyList struct {
func pinLsKeys(args []string, typeStr string, ctx context.Context, n *core.IpfsNode) (map[string]RefKeyObject, error) {
mode, ok := pin.StringToPinMode(typeStr)
if !ok {
return nil, fmt.Errorf("Invalid pin mode '%s'", typeStr)
}
keys := make(map[string]RefKeyObject)
for _, p := range args {
......@@ -277,17 +282,11 @@ func pinLsKeys(args []string, typeStr string, ctx context.Context, n *core.IpfsN
return nil, err
}
dagNode, err := core.Resolve(ctx, n.Namesys, n.Resolver, pth)
c, err := core.ResolveToCid(ctx, n, pth)
if err != nil {
return nil, err
}
mode, ok := pin.StringToPinMode(typeStr)
if !ok {
return nil, fmt.Errorf("Invalid pin mode '%s'", typeStr)
}
c := dagNode.Cid()
pinType, pinned, err := n.Pinning.IsPinnedWithType(c, mode)
if err != nil {
return nil, err
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论