fix: use MultihashFromBytes

This commit is contained in:
Derrick Hammer 2024-01-17 11:29:23 -05:00
parent 5a6c322524
commit d0da02184b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -104,7 +104,7 @@ func CIDFromBytes(bytes []byte) (*CID, error) {
return initCID(bytes)
}
func CIDFromHash(bytes interface{}, size uint64, cidType types.CIDType) (*CID, error) {
func CIDFromHash(bytes interface{}, size uint64, cidType types.CIDType, hashType types.HashType) (*CID, error) {
var (
byteSlice []byte
err error
@ -126,7 +126,7 @@ func CIDFromHash(bytes interface{}, size uint64, cidType types.CIDType) (*CID, e
return nil, fmt.Errorf("invalid hash type %d", cidType)
}
return NewCID(cidType, *NewMultihash(byteSlice), size), nil
return NewCID(cidType, *MultihashFromBytes(byteSlice, hashType), size), nil
}
func CIDVerify(bytes interface{}) bool {