From cd856cb2133d390758bb24b88fa3b538bb7bc306 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 6 Mar 2015 18:26:16 +0100 Subject: Separated block db from state db. Partial fix for #416 --- rpc/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rpc') diff --git a/rpc/api.go b/rpc/api.go index 28024c206..ae1e1504f 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -83,7 +83,7 @@ func (self *EthereumApi) setStateByBlockNumber(num int64) { block = chain.GetBlockByNumber(uint64(num)) if block != nil { - self.useState(state.New(block.Root(), self.xeth().Backend().Db())) + self.useState(state.New(block.Root(), self.xeth().Backend().StateDb())) } else { self.useState(chain.State()) } -- cgit From 20741a96ac6dc824bcc7d67e7c966fa65cbb2faf Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 9 Mar 2015 13:50:05 +0100 Subject: Updated xeth instances to take extra param for ui.Interface Please be aware that if any of the instances on xeth.frontend are called the program will crash due to the default, temporarily, frontend interface. --- rpc/api.go | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'rpc') diff --git a/rpc/api.go b/rpc/api.go index ae1e1504f..70a8cf9b4 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -9,7 +9,6 @@ For each request type, define the following: package rpc import ( - "fmt" "math/big" "strings" "sync" @@ -23,7 +22,6 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/ui" "github.com/ethereum/go-ethereum/xeth" ) @@ -721,14 +719,3 @@ func (self *EthereumApi) useState(statedb *state.StateDB) { self.eth = self.eth.UseState(statedb) } - -func t(f ui.Frontend) { - // Call the password dialog - ret, err := f.Call("PasswordDialog") - if err != nil { - fmt.Println(err) - } - // Get the first argument - t, _ := ret.Get(0) - fmt.Println("return:", t) -} -- cgit From 676a0de58d3d7c508b0eeeff192d2095a46f7382 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 9 Mar 2015 17:28:12 +0100 Subject: Max size JSON data. Closes #418 --- rpc/http/server.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rpc') diff --git a/rpc/http/server.go b/rpc/http/server.go index 452b7c9af..d8f0157f1 100644 --- a/rpc/http/server.go +++ b/rpc/http/server.go @@ -29,6 +29,8 @@ import ( var rpchttplogger = logger.NewLogger("RPC-HTTP") var JSON rpc.JsonWrapper +const maxSizeReqLength = 1024 * 1024 // 1MB + func NewRpcHttpServer(pipe *xeth.XEth, address string, port int) (*RpcHttpServer, error) { sport := fmt.Sprintf("%s:%d", address, port) l, err := net.Listen("tcp", sport) @@ -92,6 +94,12 @@ func (s *RpcHttpServer) apiHandler(api *rpc.EthereumApi) http.Handler { rpchttplogger.DebugDetailln("Handling request") + if req.ContentLength > maxSizeReqLength { + jsonerr := &rpc.RpcErrorObject{-32700, "Error: Request too large"} + JSON.Send(w, &rpc.RpcErrorResponse{JsonRpc: jsonrpcver, ID: nil, Error: jsonerr}) + return + } + reqParsed, reqerr := JSON.ParseRequestBody(req) if reqerr != nil { jsonerr := &rpc.RpcErrorObject{-32700, "Error: Could not parse request"} -- cgit .3 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines