From a83b9037e41538cf30791b037a7f82d7cf544998 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Mon, 6 Oct 2014 02:26:50 -0700 Subject: [PATCH] u.Hash - error 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 --- blocks.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/blocks.go b/blocks.go index c58ab9f..b45c1d1 100644 --- a/blocks.go +++ b/blocks.go @@ -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.