chore: avoid re-validated already validated CIDs

This commit is contained in:
Steven Allen
2019-12-02 20:35:27 -05:00
parent 58b483a841
commit 08e15f8a6c
2 changed files with 2 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ func (p V0Builder) Sum(data []byte) (Cid, error) {
if err != nil { if err != nil {
return Undef, err return Undef, err
} }
return NewCidV0(hash), nil return Cid{string(hash)}, nil
} }
func (p V0Builder) GetCodec() uint64 { func (p V0Builder) GetCodec() uint64 {

2
cid.go
View File

@@ -613,7 +613,7 @@ func CidFromBytes(data []byte) (int, Cid, error) {
return 0, Undef, err return 0, Undef, err
} }
return 34, NewCidV0(h), nil return 34, Cid{string(h)}, nil
} }
vers, n := binary.Uvarint(data) vers, n := binary.Uvarint(data)