Currently, Prefix.MhLength is an int and -1 can be (and is) used to mean "default length". Unfortunately, this means:
cid1.Bytes() == cid2.Bytes() does not imply cid1.Prefix() == cid2.Prefix().
Prefix.Bytes() is broken.
Solutions:
- Make it a uint64, provide some convenience constructors constructors (e.g.
func V1Prefix(codec uint64, mhType uint64) Prefix). This will break things.
- Fix
Prefix.Bytes() and provide an Equals method (less convenient in the long run).
Thoughts?
Currently,
Prefix.MhLengthis anintand-1can be (and is) used to mean "default length". Unfortunately, this means:cid1.Bytes() == cid2.Bytes()does not implycid1.Prefix() == cid2.Prefix().Prefix.Bytes()is broken.Solutions:
func V1Prefix(codec uint64, mhType uint64) Prefix). This will break things.Prefix.Bytes()and provide anEqualsmethod (less convenient in the long run).Thoughts?