From 6d9295ea67b203a30428c5a362c5adf311ff5331 Mon Sep 17 00:00:00 2001 From: RJ Catalano Date: Tue, 13 Jun 2017 18:45:01 -0500 Subject: [PATCH] accounts/abi: fix for the array set and for creating a bool Signed-off-by: RJ Catalano --- accounts/abi/unpack.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/accounts/abi/unpack.go b/accounts/abi/unpack.go index 4f54aa3827..e85621b1ec 100644 --- a/accounts/abi/unpack.go +++ b/accounts/abi/unpack.go @@ -111,13 +111,17 @@ func toGoSlice(i int, t Argument, output []byte) (interface{}, error) { var ( inter interface{} // interface type returnOutput = slice[i*32 : i*32+32] // the return output + err error ) // set inter to the correct type (cast) switch elem.T { case IntTy, UintTy: inter = readInteger(t.Type.Kind, returnOutput) case BoolTy: - inter = !allZero(returnOutput) + inter, err = getBoolValue(returnOutput) + if err != nil { + return nil, err + } case AddressTy: inter = common.BytesToAddress(returnOutput) case HashTy: @@ -162,7 +166,10 @@ func getBoolValue(b []byte) (bool, error) { return false, fmt.Errorf("abi: Improperly encoded boolean value.") } } - return bool(b[31]), nil + if uint(b[31]) == 1 { + return true, nil + } + return false, nil } // toGoType parses the input and casts it to the proper type defined by the ABI