diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-22 20:26:18 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-22 20:26:18 +0800 |
commit | 8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a (patch) | |
tree | 041b8f74bdcd290268a6b800e5fced2c20c98d88 /rpc | |
parent | 5912f0a849f64f8a4d7b681df8d101f3f4080e17 (diff) | |
parent | 321dce1f47135f673730cb86fdf1faf03dc6cbd4 (diff) | |
download | go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.tar go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.tar.gz go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.tar.bz2 go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.tar.lz go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.tar.xz go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.tar.zst go-tangerine-8cc6647ebfd3e76a7d75e1d6961a8451fa5d702a.zip |
Merge branch 'release/0.8.5'v0.8.5
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/packages.go | 15 | ||||
-rw-r--r-- | rpc/util.go | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/rpc/packages.go b/rpc/packages.go index aed43cae2..b51bde7ce 100644 --- a/rpc/packages.go +++ b/rpc/packages.go @@ -167,6 +167,15 @@ func (self *EthereumApi) Logs(id int, reply *interface{}) error { return nil } +func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error { + filter := core.NewFilter(self.xeth.Backend()) + filter.SetOptions(toFilterOptions(args)) + + *reply = toLogs(filter.Find()) + + return nil +} + func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error { err := args.requirements() if err != nil { @@ -509,6 +518,12 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return err } return p.Logs(args, reply) + case "eth_logs": + args, err := req.ToFilterArgs() + if err != nil { + return err + } + return p.AllLogs(args, reply) case "eth_gasPrice": *reply = defaultGasPrice return nil diff --git a/rpc/util.go b/rpc/util.go index 29824bcdb..1939b3474 100644 --- a/rpc/util.go +++ b/rpc/util.go @@ -84,6 +84,7 @@ type Log struct { Address string `json:"address"` Topic []string `json:"topics"` Data string `json:"data"` + Number uint64 `json:"number"` } func toLogs(logs state.Logs) (ls []Log) { @@ -94,6 +95,7 @@ func toLogs(logs state.Logs) (ls []Log) { l.Topic = make([]string, len(log.Topics())) l.Address = toHex(log.Address()) l.Data = toHex(log.Data()) + l.Number = log.Number() for j, topic := range log.Topics() { l.Topic[j] = toHex(topic) } |