Decide how to handle -1 in Prefix
Open
- Dominant language
- Go
- Stars
- 171
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
Currently, `Prefix.MhLength` is an `int` and `-1` can be (and is) used to mean "default length". Unfortunately, this means:
1. `cid1.Bytes() == cid2.Bytes()` does not imply `cid1.Prefix() == cid2.Prefix()`.
2. `Prefix.Bytes()` is broken.
Solutions:
1. Make it a uint64, provide some convenience constructors constructors (e.g. `func V1Prefix(codec uint64, mhType uint64) Prefix`). This will break things.
2. Fix `Prefix.Bytes()` and provide an `Equals` method (less convenient in the long run).
Thoughts?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.