accounts/abi: simplify readBool

No other read* function checks the length, so don't do it in readBool.
This commit is contained in:
Felix Lange 2017-09-10 12:16:17 +02:00 committed by Bas van Kervel
parent c86e965cb9
commit c156f68092
No known key found for this signature in database
GPG key ID: BFB23B252EF5812B

View file

@ -60,12 +60,8 @@ func readInteger(kind reflect.Kind, b []byte) interface{} {
// reads a bool // reads a bool
func readBool(word []byte) (bool, error) { func readBool(word []byte) (bool, error) {
if len(word) != 32 { for _, b := range word[:31] {
return false, fmt.Errorf("abi: fatal error: incorrect word length") if b != 0 {
}
for i, b := range word {
if b != 0 && i != 31 {
return false, errBadBool return false, errBadBool
} }
} }