From 2ff5aec80ea4083840bcc6c1a90be39fc260423c Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 2 Mar 2021 18:15:05 +0200 Subject: [PATCH] satisfy linter, use Prefix for common path of non inline CIDs --- blockstore/idstore.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blockstore/idstore.go b/blockstore/idstore.go index ab6d8e105..e6148ff04 100644 --- a/blockstore/idstore.go +++ b/blockstore/idstore.go @@ -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 }