Commit f4c929d4 authored by Jakub Sztandera's avatar Jakub Sztandera

Remove verifcid as it is handled in go-cid

parent da91d9e4
......@@ -14,7 +14,6 @@ import (
blockstore "github.com/ipfs/go-ipfs-blockstore"
exchange "github.com/ipfs/go-ipfs-exchange-interface"
logging "github.com/ipfs/go-log"
"github.com/ipfs/go-verifcid"
)
var log = logging.Logger("blockservice")
......@@ -131,11 +130,6 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
// TODO pass a context into this if the remote.HasBlock is going to remain here.
func (s *blockService) AddBlock(o blocks.Block) error {
c := o.Cid()
// hash security
err := verifcid.ValidateCid(c)
if err != nil {
return err
}
if s.checkFirst {
if has, err := s.blockstore.Has(c); has || err != nil {
return err
......@@ -156,13 +150,6 @@ func (s *blockService) AddBlock(o blocks.Block) error {
}
func (s *blockService) AddBlocks(bs []blocks.Block) error {
// hash security
for _, b := range bs {
err := verifcid.ValidateCid(b.Cid())
if err != nil {
return err
}
}
var toput []blocks.Block
if s.checkFirst {
toput = make([]blocks.Block, 0, len(bs))
......@@ -211,11 +198,6 @@ func (s *blockService) getExchange() exchange.Fetcher {
}
func getBlock(ctx context.Context, c cid.Cid, bs blockstore.Blockstore, fget func() exchange.Fetcher) (blocks.Block, error) {
err := verifcid.ValidateCid(c) // hash security
if err != nil {
return nil, err
}
block, err := bs.Get(c)
if err == nil {
return block, nil
......@@ -259,18 +241,6 @@ func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget
go func() {
defer close(out)
k := 0
for _, c := range ks {
// hash security
if err := verifcid.ValidateCid(c); err == nil {
ks[k] = c
k++
} else {
log.Errorf("unsafe CID (%s) passed to blockService.GetBlocks: %s", c, err)
}
}
ks = ks[:k]
var misses []cid.Cid
for _, c := range ks {
hit, err := bs.Get(c)
......
......@@ -36,12 +36,6 @@
"hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK",
"name": "go-block-format",
"version": "0.2.2"
},
{
"author": "why",
"hash": "QmcVd2ApQdbfaYPKhCjj4WoQuxk4CMxPqmNpijKmFLh6qa",
"name": "go-verifcid",
"version": "0.1.2"
}
],
"gxVersion": "0.12.1",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment