Skip to content

Commit

Permalink
Merge pull request #3307 from ipfs/feat/raw-nodes
Browse files Browse the repository at this point in the history
Implement 'Raw Node' node type
  • Loading branch information
whyrusleeping authored Oct 24, 2016
2 parents c38ced0 + bc1f635 commit e00a147
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ func NewBlock(data []byte) *BasicBlock {
// we are able to be confident that the data is correct
func NewBlockWithCid(data []byte, c *cid.Cid) (*BasicBlock, error) {
if u.Debug {
// TODO: fix assumptions
chkc := cid.NewCidV0(u.Hash(data))
chkc, err := c.Prefix().Sum(data)
if err != nil {
return nil, err
}

if !chkc.Equals(c) {
return nil, ErrWrongHash
}
Expand Down

0 comments on commit e00a147

Please sign in to comment.