Commit cd73b670 authored by Eric Myhre's avatar Eric Myhre

cidlink: use cids in all messages.

Emitting just the multihash part, though in some ways technically
correct, is really weird looking.

Let's use the CID consistently in messaging.
Signed-off-by: default avatarEric Myhre <hash@exultant.us>
parent cc0c2f24
......@@ -8,7 +8,6 @@ import (
cid "github.com/ipfs/go-cid"
ipld "github.com/ipld/go-ipld-prime"
multihash "github.com/multiformats/go-multihash"
)
var (
......@@ -44,12 +43,12 @@ func (lnk Link) Load(ctx context.Context, lnkCtx ipld.LinkContext, nb ipld.NodeB
return nil, err
}
}
hash, err := multihash.Sum(hasher.Bytes(), lnk.Prefix().MhType, lnk.Prefix().MhLength)
cid, err := lnk.Prefix().Sum(hasher.Bytes())
if err != nil {
return nil, err
}
if hash.B58String() != lnk.Hash().B58String() {
return nil, fmt.Errorf("hash mismatch! %q != %q", lnk.Hash().B58String(), hash.B58String())
if cid != lnk.Cid {
return nil, fmt.Errorf("hash mismatch! %q (actual) != %q (expected)", cid, lnk.Cid)
}
if decodeErr != nil {
return nil, decodeErr
......
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