satisfy linter, use Prefix for common path of non inline CIDs

This commit is contained in:
vyzo 2021-03-02 18:15:05 +02:00
parent 8a55b73146
commit 2ff5aec80e

View File

@ -22,12 +22,16 @@ func NewIDStore(bs Blockstore) Blockstore {
}
func decodeCid(cid cid.Cid) (inline bool, data []byte, err error) {
if cid.Prefix().MhType != mh.IDENTITY {
return false, nil, nil
}
dmh, err := mh.Decode(cid.Hash())
if err != nil {
return false, nil, err
}
if dmh.Code == mh.ID {
if dmh.Code == mh.IDENTITY {
return true, dmh.Digest, nil
}