aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/reflect.go
diff options
context:
space:
mode:
authorJavier Peletier <jm@epiclabs.io>2018-03-05 23:01:40 +0800
committerJavier Peletier <jm@epiclabs.io>2018-03-05 23:01:40 +0800
commit60a999f238fca7c83b26ecf94257ee648afe4df9 (patch)
tree6416f68dcfe0b4bb6658b7a637db1a01282ca35d /accounts/abi/reflect.go
parent13b566e06e9aae28bddde431c7d53a335272411a (diff)
downloaddexon-60a999f238fca7c83b26ecf94257ee648afe4df9.tar
dexon-60a999f238fca7c83b26ecf94257ee648afe4df9.tar.gz
dexon-60a999f238fca7c83b26ecf94257ee648afe4df9.tar.bz2
dexon-60a999f238fca7c83b26ecf94257ee648afe4df9.tar.lz
dexon-60a999f238fca7c83b26ecf94257ee648afe4df9.tar.xz
dexon-60a999f238fca7c83b26ecf94257ee648afe4df9.tar.zst
dexon-60a999f238fca7c83b26ecf94257ee648afe4df9.zip
accounts/abi: Modified unpackAtomic to accept struct lvalues
Diffstat (limited to 'accounts/abi/reflect.go')
-rw-r--r--accounts/abi/reflect.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/accounts/abi/reflect.go b/accounts/abi/reflect.go
index 7a9cdacd5..2e6bf7098 100644
--- a/accounts/abi/reflect.go
+++ b/accounts/abi/reflect.go
@@ -110,3 +110,19 @@ func requireUnpackKind(v reflect.Value, t reflect.Type, k reflect.Kind,
}
return nil
}
+
+// requireUniqueStructFieldNames makes sure field names don't collide
+func requireUniqueStructFieldNames(args Arguments) error {
+ exists := make(map[string]bool)
+ for _, arg := range args {
+ field := capitalise(arg.Name)
+ if field == "" {
+ return fmt.Errorf("abi: purely underscored output cannot unpack to struct")
+ }
+ if exists[field] {
+ return fmt.Errorf("abi: multiple outputs mapping to the same struct field '%s'", field)
+ }
+ exists[field] = true
+ }
+ return nil
+}