From cb853eb52122c999303f725f19095a9b47e4b46c Mon Sep 17 00:00:00 2001 From: RJ Catalano Date: Wed, 14 Jun 2017 08:34:56 -0500 Subject: [PATCH] accounts/abi: fix up error message and variable names Signed-off-by: RJ Catalano --- accounts/abi/unpack.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/accounts/abi/unpack.go b/accounts/abi/unpack.go index cbd6fa85e6..b6c41de682 100644 --- a/accounts/abi/unpack.go +++ b/accounts/abi/unpack.go @@ -160,19 +160,20 @@ func readInteger(kind reflect.Kind, b []byte) interface{} { } } -func getBoolValue(b []byte) (bool, error) { - for i, byte := range b { - if byte != 0 && i != 31 { - return false, fmt.Errorf("abi: Improperly encoded boolean value.") +func getBoolValue(word []byte) (bool, error) { + improperEncoding := "abi: improperly encoded boolean value" + for i, b := range word { + if b != 0 && i != 31 { + return false, fmt.Errorf(improperEncoding) } } - switch uint(b[31]) { + switch word[31] { case 0: return false, nil case 1: return true, nil default: - return false, fmt.Errorf("abi: Improperly encoded boolean value.") + return false, fmt.Errorf(improperEncoding) } }