aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/reflect.go
diff options
context:
space:
mode:
authorRobert Zaremba <robert.zaremba@scale-it.pl>2017-11-10 09:30:26 +0800
committerMartin Holst Swende <martin@swende.se>2017-12-21 22:14:50 +0800
commit0ed8b838a991f81f79cc6ed4fa961c563203a7a2 (patch)
tree1b6c813a7271b73b4bc0f57ad8bf2ce49325285e /accounts/abi/reflect.go
parent9becba5540540bc37d4ad5eaaf7e4c1937a6542f (diff)
downloadgo-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.tar
go-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.tar.gz
go-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.tar.bz2
go-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.tar.lz
go-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.tar.xz
go-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.tar.zst
go-tangerine-0ed8b838a991f81f79cc6ed4fa961c563203a7a2.zip
accounts/abi: fix event unpack into slice
+ The event slice unpacker doesn't correctly extract element from the slice. The indexed arguments are not ignored as they should be (the data offset should not include the indexed arguments). + The `Elem()` call in the slice unpack doesn't work. The Slice related tests fails because of that. + the check in the loop are suboptimal and have been extracted out of the loop. + extracted common code from event and method tupleUnpack
Diffstat (limited to 'accounts/abi/reflect.go')
-rw-r--r--accounts/abi/reflect.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/accounts/abi/reflect.go b/accounts/abi/reflect.go
index e953b77c1..fbcd576e5 100644
--- a/accounts/abi/reflect.go
+++ b/accounts/abi/reflect.go
@@ -85,3 +85,11 @@ func set(dst, src reflect.Value, output Argument) error {
}
return nil
}
+
+// requireAssignable assures that `dest` is a pointer and it's not an interface.
+func requireAssignable(dst, src reflect.Value) error {
+ if dst.Kind() != reflect.Ptr && dst.Kind() != reflect.Interface {
+ return fmt.Errorf("abi: cannot unmarshal %v into %v", src.Type(), dst.Type())
+ }
+ return nil
+}