diff --git a/types/address/hash.go b/types/address/hash.go index 912b831fc2da..8d9c5b39e11b 100644 --- a/types/address/hash.go +++ b/types/address/hash.go @@ -20,12 +20,13 @@ type Addressable interface { // Hash creates a new address from address type and key func Hash(typ string, key []byte) []byte { hasher := sha256.New() - hasher.Write(conv.UnsafeStrToBytes(typ)) + _, err := hasher.Write(conv.UnsafeStrToBytes(typ)) + // the error always nil, it's here only to satisfy the io.Writer interface + errors.AssertNil(err) th := hasher.Sum(nil) hasher.Reset() - _, err := hasher.Write(th) - // the error always nil, it's here only to satisfy the io.Writer interface + _, err = hasher.Write(th) errors.AssertNil(err) _, err = hasher.Write(key) errors.AssertNil(err)