accounts/abi: be very very very correct

Signed-off-by: RJ Catalano <rj@monax.io>
This commit is contained in:
RJ Catalano 2017-06-13 18:50:00 -05:00
parent 6d9295ea67
commit 1253f2cc58
No known key found for this signature in database
GPG key ID: D4AB109D9B5D6386

View file

@ -166,10 +166,15 @@ func getBoolValue(b []byte) (bool, error) {
return false, fmt.Errorf("abi: Improperly encoded boolean value.") return false, fmt.Errorf("abi: Improperly encoded boolean value.")
} }
} }
if uint(b[31]) == 1 { switch uint(b[31]) {
case 0:
return false, nil
case 1:
return true, nil return true, nil
default:
return false, fmt.Errorf("abi: Improperly encoded boolean value.")
} }
return false, nil
} }
// toGoType parses the input and casts it to the proper type defined by the ABI // toGoType parses the input and casts it to the proper type defined by the ABI