From 60c43d195289e65af2146d8655350b7f7dca66b7 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 18 Mar 2015 11:10:08 -0400 Subject: Remove i2hex --- rpc/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index 57075bffc..6154a0b28 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -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 } @@ -198,7 +198,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 } -- cgit v1.2.3 From 8b20c3cc976a149c64ef0ac2cabbe49e93ba739d Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 18 Mar 2015 20:30:09 -0400 Subject: Validate NewTx From field is not blank --- rpc/api.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index 6154a0b28..5d4e235d9 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -257,6 +257,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 { -- cgit v1.2.3 From 14a2f42f3700640f191e0095b50a266d2a919b38 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 19 Mar 2015 16:19:54 +0100 Subject: fixed chain event. Closes #529 --- rpc/api.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'rpc/api.go') 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) -- cgit v1.2.3