From a6bfca5b188d065f8bcda6f782a6b8e4d8ed3a77 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Mon, 16 Oct 2017 10:12:04 +0200 Subject: [PATCH] common: fix compilation error on len of type Hash and Address --- common/types.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/types.go b/common/types.go index d31bbf741b..d736da1b24 100644 --- a/common/types.go +++ b/common/types.go @@ -90,7 +90,7 @@ func (h Hash) MarshalText() ([]byte, error) { // Sets the hash to the value of b. If b is larger than len(h), 'b' will be cropped (from the left). func (h *Hash) SetBytes(b []byte) { - if len(b) > len(h) { + if len(b) > HashLength { b = b[len(b)-HashLength:] } @@ -200,7 +200,7 @@ func (a Address) Format(s fmt.State, c rune) { // Sets the address to the value of b. If b is larger than len(a) it will panic func (a *Address) SetBytes(b []byte) { - if len(b) > len(a) { + if len(b) > AddressLength { b = b[len(b)-AddressLength:] } copy(a[AddressLength-len(b):], b)