mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
accounts/abi: simplify readBool
No other read* function checks the length, so don't do it in readBool.
This commit is contained in:
parent
c86e965cb9
commit
c156f68092
1 changed files with 2 additions and 6 deletions
|
|
@ -60,12 +60,8 @@ func readInteger(kind reflect.Kind, b []byte) interface{} {
|
|||
|
||||
// reads a bool
|
||||
func readBool(word []byte) (bool, error) {
|
||||
if len(word) != 32 {
|
||||
return false, fmt.Errorf("abi: fatal error: incorrect word length")
|
||||
}
|
||||
|
||||
for i, b := range word {
|
||||
if b != 0 && i != 31 {
|
||||
for _, b := range word[:31] {
|
||||
if b != 0 {
|
||||
return false, errBadBool
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue