Fix lengths in prefix too
This commit is contained in:
2
cid.go
2
cid.go
@@ -266,7 +266,7 @@ func (p Prefix) Sum(data []byte) (*Cid, error) {
|
||||
}
|
||||
|
||||
func (p Prefix) Bytes() []byte {
|
||||
buf := make([]byte, 16)
|
||||
buf := make([]byte, 4*binary.MaxVarintLen64)
|
||||
n := binary.PutUvarint(buf, p.Version)
|
||||
n += binary.PutUvarint(buf[n:], p.Codec)
|
||||
n += binary.PutUvarint(buf[n:], uint64(p.MhType))
|
||||
|
||||
@@ -124,7 +124,7 @@ func Test16BytesVarint(t *testing.T) {
|
||||
hash, _ := mh.Sum(data, mh.SHA2_256, -1)
|
||||
c := NewCidV1(CBOR, hash)
|
||||
|
||||
c.codec = 1 << 54
|
||||
c.codec = 1 << 63
|
||||
_ = c.Bytes()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user