diff options
author | RJ Catalano <catalanor0220@gmail.com> | 2017-10-17 19:07:08 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-10-17 19:07:08 +0800 |
commit | dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d (patch) | |
tree | 7e4713ca276ac1a2cef7cd2dd19dcf8c6fd1f6c4 /accounts/abi/reflect.go | |
parent | e9295163aa25479e817efee4aac23eaeb7554bba (diff) | |
download | dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.tar dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.tar.gz dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.tar.bz2 dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.tar.lz dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.tar.xz dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.tar.zst dexon-dec8bba9d4c5fcb3dd7e51f0f794b3e895c7f52d.zip |
accounts/abi: improve type handling, add event support (#14743)
Diffstat (limited to 'accounts/abi/reflect.go')
-rw-r--r-- | accounts/abi/reflect.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/accounts/abi/reflect.go b/accounts/abi/reflect.go index 8fa75df07..e953b77c1 100644 --- a/accounts/abi/reflect.go +++ b/accounts/abi/reflect.go @@ -24,7 +24,7 @@ import ( // indirect recursively dereferences the value until it either gets the value // or finds a big.Int func indirect(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Ptr && v.Elem().Type() != big_t { + if v.Kind() == reflect.Ptr && v.Elem().Type() != derefbig_t { return indirect(v.Elem()) } return v @@ -73,15 +73,9 @@ func mustArrayToByteSlice(value reflect.Value) reflect.Value { func set(dst, src reflect.Value, output Argument) error { dstType := dst.Type() srcType := src.Type() - switch { - case dstType.AssignableTo(src.Type()): + case dstType.AssignableTo(srcType): dst.Set(src) - case dstType.Kind() == reflect.Array && srcType.Kind() == reflect.Slice: - if dst.Len() < output.Type.SliceSize { - return fmt.Errorf("abi: cannot unmarshal src (len=%d) in to dst (len=%d)", output.Type.SliceSize, dst.Len()) - } - reflect.Copy(dst, src) case dstType.Kind() == reflect.Interface: dst.Set(src) case dstType.Kind() == reflect.Ptr: |