diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-20 21:01:35 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-20 21:01:35 +0800 |
commit | 28ddc16a9b5779b6b31036e8248ed8457de7b443 (patch) | |
tree | 7508db500151bdaf0ebed726286f823e67993103 /rpc/api.go | |
parent | c161d73d429ef421cdb9c75b743c16d72aa8a89a (diff) | |
parent | 01ff0b3176e6d83dcc5e6716f04301de71e3fc9e (diff) | |
download | dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.gz dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.bz2 dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.lz dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.xz dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.tar.zst dexon-28ddc16a9b5779b6b31036e8248ed8457de7b443.zip |
Merge remote-tracking branch 'ethereum/conversion' into conversion
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/rpc/api.go b/rpc/api.go index 486eec008..39a6b8f5b 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 } @@ -161,7 +161,7 @@ func (self *EthereumApi) NewFilter(args *FilterOptions, reply *interface{}) erro id = self.filterManager.InstallFilter(filter) self.logs[id] = &logFilter{timeout: time.Now()} - *reply = i2hex(id) + *reply = common.ToHex(big.NewInt(int64(id)).Bytes()) return nil } @@ -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{}) } @@ -198,7 +201,7 @@ func (self *EthereumApi) NewFilterString(args *FilterStringArgs, reply *interfac id = self.filterManager.InstallFilter(filter) self.logs[id] = &logFilter{timeout: time.Now()} - *reply = i2hex(id) + *reply = common.ToHex(big.NewInt(int64(id)).Bytes()) return nil } @@ -257,6 +260,11 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) (err error) p.register[ags.From] = append(p.register[args.From], args) } */ + + if err := args.requirements(); err != nil { + return err + } + // TODO: align default values to have the same type, e.g. not depend on // common.Value conversions later on if args.Gas.Cmp(big.NewInt(0)) == 0 { |