fix bug 6748 ipfs add whit only hash, don't need to announce cid to other peer
fix bug 6748 ipfs add whit only hash, don't need to announce cid to other peer
hucg committed
Nov 8, 2019 at 15:12 UTC
6ded0ba0f83345afd0d62a5437b74d9a16543ef5
1 file changed
+4
-2
core/coreapi/unixfs.go
+4
-2
@@ -127,8 +127,10 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
127
return nil, err
128
}
129
130
- if err := api.provider.Provide(nd.Cid()); err != nil {
131
- return nil, err
130
+ if !settings.OnlyHash {
131
+ if err := api.provider.Provide(nd.Cid()); err != nil {
132
+ return nil, err
133
+ }
134
}
135
136
return path.IpfsPath(nd.Cid()), nil