提交 70949b0f 作者: Kevin Atkinson

Checkpoint.

上级 c6ee301a
......@@ -23,11 +23,11 @@ func rawRawParser(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) {
return nil, err
}
h, err := mh.Sum(data, mhType, mhLen)
prefix := cid.NewPrefixV1(cid.Raw, mhType, mhLen)
c, err := prefix.Sum(data)
if err != nil {
return nil, err
}
c := cid.NewCidV1(cid.Raw, h)
blk, err := block.NewBlockWithCid(data, c)
if err != nil {
return nil, err
......
......@@ -17,7 +17,7 @@ type RawNode struct {
// NewRawNode creates a RawNode using the default sha2-256 hash function.
func NewRawNode(data []byte) *RawNode {
h := u.Hash(data)
c := cid.NewCidV1(cid.Raw, h)
c, _ := cid.NewCidV1(cid.Raw, h)
blk, _ := blocks.NewBlockWithCid(data, c)
return &RawNode{blk}
......
......@@ -101,7 +101,8 @@ func (r *IpnsResolver) resolveOnce(ctx context.Context, name string, options *op
if valh, err := mh.Cast(entry.GetValue()); err == nil {
// Its an old style multihash record
log.Debugf("encountered CIDv0 ipns entry: %s", valh)
p = path.FromCid(cid.NewCidV0(valh))
c, _ := cid.NewCidV0(valh)
p = path.FromCid(c)
} else {
// Not a multihash, probably a new record
p, err = path.ParsePath(string(entry.GetValue()))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论