aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:52:36 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:52:36 +0800
commit12d87226a74d3c4095ea8e189c30ff31fcadf59f (patch)
tree3b4b3bb6dd381aeb4e0a25ad5ed891d5b6cf00f0 /rpc/api.go
parent14a2f42f3700640f191e0095b50a266d2a919b38 (diff)
parentabc3d8d50a8691d9b4c2bd047807908d157e223c (diff)
downloadgo-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.gz
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.bz2
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.lz
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.xz
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.tar.zst
go-tangerine-12d87226a74d3c4095ea8e189c30ff31fcadf59f.zip
Merge branch 'rpcutil' into rpcfrontier
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go39
1 files changed, 36 insertions, 3 deletions
diff --git a/rpc/api.go b/rpc/api.go
index a0c12f837..4f86e703d 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -211,7 +211,7 @@ func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error {
defer self.logMut.Unlock()
if self.logs[id] != nil {
- *reply = toLogs(self.logs[id].get())
+ *reply = NewLogsRes(self.logs[id].get())
}
return nil
@@ -223,7 +223,7 @@ func (self *EthereumApi) Logs(id int, reply *interface{}) error {
filter := self.filterManager.GetFilter(id)
if filter != nil {
- *reply = toLogs(filter.Find())
+ *reply = NewLogsRes(filter.Find())
}
return nil
@@ -233,7 +233,7 @@ func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error
filter := core.NewFilter(self.xeth().Backend())
filter.SetOptions(toFilterOptions(args))
- *reply = toLogs(filter.Find())
+ *reply = NewLogsRes(filter.Find())
return nil
}
@@ -870,3 +870,36 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions {
return opts
}
+
+type whisperFilter struct {
+ messages []xeth.WhisperMessage
+ timeout time.Time
+ id int
+}
+
+func (w *whisperFilter) add(msgs ...xeth.WhisperMessage) {
+ w.messages = append(w.messages, msgs...)
+}
+func (w *whisperFilter) get() []xeth.WhisperMessage {
+ w.timeout = time.Now()
+ tmp := w.messages
+ w.messages = nil
+ return tmp
+}
+
+type logFilter struct {
+ logs state.Logs
+ timeout time.Time
+ id int
+}
+
+func (l *logFilter) add(logs ...state.Log) {
+ l.logs = append(l.logs, logs...)
+}
+
+func (l *logFilter) get() state.Logs {
+ l.timeout = time.Now()
+ tmp := l.logs
+ l.logs = nil
+ return tmp
+}