diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-02 02:08:26 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-02 02:08:26 +0800 |
commit | 6e50a1e9f59532671eaa2bb2f2081a67f659bd0d (patch) | |
tree | 9dcb5fa46e7500f98e54458564a0409a2b77de80 /rpc | |
parent | ac88ae86a3f6fa5d5a957bac9d96e0a2027ac068 (diff) | |
download | dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.tar dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.tar.gz dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.tar.bz2 dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.tar.lz dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.tar.xz dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.tar.zst dexon-6e50a1e9f59532671eaa2bb2f2081a67f659bd0d.zip |
Filter accepts multiple topics per entry. Fixes #403
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/args.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rpc/args.go b/rpc/args.go index e839da8bf..ea8489585 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -197,7 +197,7 @@ type FilterOptions struct { Earliest int64 Latest int64 Address interface{} - Topic []string + Topic []interface{} Skip int Max int } @@ -220,10 +220,20 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions { opts.Earliest = options.Earliest opts.Latest = options.Latest - opts.Topics = make([][]byte, len(options.Topic)) - for i, topic := range options.Topic { - opts.Topics[i] = fromHex(topic) + + topics := make([][][]byte, len(options.Topic)) + for i, topicDat := range options.Topic { + if slice, ok := topicDat.([]interface{}); ok { + topics[i] = make([][]byte, len(slice)) + for j, topic := range slice { + topics[i][j] = fromHex(topic.(string)) + } + } else if str, ok := topicDat.(string); ok { + topics[i] = make([][]byte, 1) + topics[i][0] = fromHex(str) + } } + opts.Topics = topics return opts } |