Commit 7e576d41 authored by Jeromy's avatar Jeromy

removed error from return type of blocks.NewBlock()

parent a83b9037
......@@ -12,8 +12,8 @@ type Block struct {
}
// NewBlock creates a Block object from opaque data. It will hash the data.
func NewBlock(data []byte) (*Block, error) {
return &Block{Data: data, Multihash: u.Hash(data)}, nil
func NewBlock(data []byte) *Block {
return &Block{Data: data, Multihash: u.Hash(data)}
}
// Key returns the block's Multihash as a Key value.
......
......@@ -6,20 +6,11 @@ func TestBlocksBasic(t *testing.T) {
// Test empty data
empty := []byte{}
_, err := NewBlock(empty)
if err != nil {
t.Fatal(err)
}
NewBlock(empty)
// Test nil case
_, err = NewBlock(nil)
if err != nil {
t.Fatal(err)
}
NewBlock(nil)
// Test some data
_, err = NewBlock([]byte("Hello world!"))
if err != nil {
t.Fatal(err)
}
NewBlock([]byte("Hello world!"))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment