diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-04 00:56:36 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-04 00:56:36 +0800 |
commit | 40ff3cac3943ee672d818776fdd8235fc6684dca (patch) | |
tree | e32f82689b0c669d61688470af5e92c2eda44d34 /rpc/args.go | |
parent | 53b5a45856c5d4c307dc55b4ae1b46efd9471142 (diff) | |
parent | 6e50a1e9f59532671eaa2bb2f2081a67f659bd0d (diff) | |
download | go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.gz go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.tar.zst go-tangerine-40ff3cac3943ee672d818776fdd8235fc6684dca.zip |
merge
Diffstat (limited to 'rpc/args.go')
-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 } |