@@ -14,7 +14,6 @@ import (
14
14
blockstore "github.com/ipfs/go-ipfs-blockstore"
15
15
exchange "github.com/ipfs/go-ipfs-exchange-interface"
16
16
logging "github.com/ipfs/go-log"
17
- "github.com/ipfs/go-verifcid"
18
17
)
19
18
20
19
var log = logging .Logger ("blockservice" )
@@ -131,11 +130,6 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
131
130
// TODO pass a context into this if the remote.HasBlock is going to remain here.
132
131
func (s * blockService ) AddBlock (o blocks.Block ) error {
133
132
c := o .Cid ()
134
- // hash security
135
- err := verifcid .ValidateCid (c )
136
- if err != nil {
137
- return err
138
- }
139
133
if s .checkFirst {
140
134
if has , err := s .blockstore .Has (c ); has || err != nil {
141
135
return err
@@ -156,13 +150,6 @@ func (s *blockService) AddBlock(o blocks.Block) error {
156
150
}
157
151
158
152
func (s * blockService ) AddBlocks (bs []blocks.Block ) error {
159
- // hash security
160
- for _ , b := range bs {
161
- err := verifcid .ValidateCid (b .Cid ())
162
- if err != nil {
163
- return err
164
- }
165
- }
166
153
var toput []blocks.Block
167
154
if s .checkFirst {
168
155
toput = make ([]blocks.Block , 0 , len (bs ))
@@ -211,11 +198,6 @@ func (s *blockService) getExchange() exchange.Fetcher {
211
198
}
212
199
213
200
func getBlock (ctx context.Context , c cid.Cid , bs blockstore.Blockstore , fget func () exchange.Fetcher ) (blocks.Block , error ) {
214
- err := verifcid .ValidateCid (c ) // hash security
215
- if err != nil {
216
- return nil , err
217
- }
218
-
219
201
block , err := bs .Get (c )
220
202
if err == nil {
221
203
return block , nil
@@ -259,18 +241,6 @@ func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget
259
241
go func () {
260
242
defer close (out )
261
243
262
- k := 0
263
- for _ , c := range ks {
264
- // hash security
265
- if err := verifcid .ValidateCid (c ); err == nil {
266
- ks [k ] = c
267
- k ++
268
- } else {
269
- log .Errorf ("unsafe CID (%s) passed to blockService.GetBlocks: %s" , c , err )
270
- }
271
- }
272
- ks = ks [:k ]
273
-
274
244
var misses []cid.Cid
275
245
for _ , c := range ks {
276
246
hit , err := bs .Get (c )
0 commit comments