aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-19 23:19:54 +0800
committerobscuren <geffobscura@gmail.com>2015-03-19 23:19:54 +0800
commit14a2f42f3700640f191e0095b50a266d2a919b38 (patch)
treee22528f68c7bdab57a8cdfbcddc29df06c15457a /rpc/api.go
parentb52807f0c0ff1b89cc1d7172ce1b768a34d02b00 (diff)
downloadgo-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.tar
go-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.tar.gz
go-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.tar.bz2
go-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.tar.lz
go-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.tar.xz
go-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.tar.zst
go-tangerine-14a2f42f3700640f191e0095b50a266d2a919b38.zip
fixed chain event. Closes #529
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 5d4e235d9..a0c12f837 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -86,7 +86,7 @@ func (self *EthereumApi) getStateWithNum(num int64) *xeth.State {
}
func (self *EthereumApi) start() {
- timer := time.NewTicker(filterTickerTime)
+ timer := time.NewTicker(2 * time.Second)
done:
for {
select {
@@ -94,20 +94,20 @@ done:
self.logMut.Lock()
self.messagesMut.Lock()
for id, filter := range self.logs {
- if time.Since(filter.timeout) > 20*time.Second {
+ if time.Since(filter.timeout) > filterTickerTime {
self.filterManager.UninstallFilter(id)
delete(self.logs, id)
}
}
for id, filter := range self.messages {
- if time.Since(filter.timeout) > 20*time.Second {
+ if time.Since(filter.timeout) > filterTickerTime {
self.xeth().Whisper().Unwatch(id)
delete(self.messages, id)
}
}
- self.logMut.Unlock()
self.messagesMut.Unlock()
+ self.logMut.Unlock()
case <-self.quit:
break done
}
@@ -180,10 +180,13 @@ func (self *EthereumApi) NewFilterString(args *FilterStringArgs, reply *interfac
var id int
filter := core.NewFilter(self.xeth().Backend())
- callback := func(block *types.Block) {
+ callback := func(block *types.Block, logs state.Logs) {
self.logMut.Lock()
defer self.logMut.Unlock()
+ for _, log := range logs {
+ self.logs[id].add(log)
+ }
self.logs[id].add(&state.StateLog{})
}
@@ -483,7 +486,7 @@ func (p *EthereumApi) GetBlockUncleCountByNumber(blocknum int64) (int64, error)
func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error {
// Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
- rpclogger.Debugf("%s %s", req.Method, req.Params)
+ rpclogger.Infof("%s %s", req.Method, req.Params)
switch req.Method {
case "web3_sha3":
args := new(Sha3Args)