mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 17:03:46 +00:00
accounts/abi: fix up error message and variable names
Signed-off-by: RJ Catalano <rj@monax.io>
This commit is contained in:
parent
1253f2cc58
commit
cb853eb521
1 changed files with 7 additions and 6 deletions
|
|
@ -160,19 +160,20 @@ func readInteger(kind reflect.Kind, b []byte) interface{} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBoolValue(b []byte) (bool, error) {
|
func getBoolValue(word []byte) (bool, error) {
|
||||||
for i, byte := range b {
|
improperEncoding := "abi: improperly encoded boolean value"
|
||||||
if byte != 0 && i != 31 {
|
for i, b := range word {
|
||||||
return false, fmt.Errorf("abi: Improperly encoded boolean value.")
|
if b != 0 && i != 31 {
|
||||||
|
return false, fmt.Errorf(improperEncoding)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch uint(b[31]) {
|
switch word[31] {
|
||||||
case 0:
|
case 0:
|
||||||
return false, nil
|
return false, nil
|
||||||
case 1:
|
case 1:
|
||||||
return true, nil
|
return true, nil
|
||||||
default:
|
default:
|
||||||
return false, fmt.Errorf("abi: Improperly encoded boolean value.")
|
return false, fmt.Errorf(improperEncoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue