Skip to content

Commit

Permalink
u.Hash - error
Browse files Browse the repository at this point in the history
the u.Hash error can be safely ignored (panic) because multihash
only fails from the selection of hash function. If the fn + length
are valid, it won't error.

cc @whyrusleeping
  • Loading branch information
jbenet committed Oct 6, 2014
1 parent f524411 commit a83b903
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ type Block struct {

// NewBlock creates a Block object from opaque data. It will hash the data.
func NewBlock(data []byte) (*Block, error) {
h, err := u.Hash(data)
if err != nil {
return nil, err
}
return &Block{Data: data, Multihash: h}, nil
return &Block{Data: data, Multihash: u.Hash(data)}, nil
}

// Key returns the block's Multihash as a Key value.
Expand Down

0 comments on commit a83b903

Please sign in to comment.