From 4391c3821567b1f5718b39ed660afb6cf65eeba3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 1 Apr 2015 23:22:03 +0200 Subject: Changed getters on account objects. Closes #610 * GetCode * GetNonce * GetStorage * GetBalance --- rpc/api.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'rpc') diff --git a/rpc/api.go b/rpc/api.go index 660bb3251..80dd27afb 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -95,10 +95,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - state := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address) - value := state.StorageString(args.Key) - - *reply = common.ToHex(value.Bytes()) + *reply = api.xethAtStateNum(args.BlockNumber).StorageAt(args.Address, args.Key) case "eth_getTransactionCount": args := new(GetTxCountArgs) if err := json.Unmarshal(req.Params, &args); err != nil { -- cgit From 0f3bf7ef4de95b8012eb9bba717323b9e89c5908 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 2 Apr 2015 12:57:04 +0200 Subject: Fixes for balance --- rpc/api.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'rpc') diff --git a/rpc/api.go b/rpc/api.go index 80dd27afb..d9206eb79 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -36,7 +36,7 @@ func (api *EthereumApi) xethAtStateNum(num int64) *xeth.XEth { func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error { // Spec at https://github.com/ethereum/wiki/wiki/JSON-RPC - rpclogger.Debugf("%s %s", req.Method, req.Params) + rpclogger.Infof("%s %s", req.Method, req.Params) switch req.Method { case "web3_sha3": @@ -80,8 +80,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - v := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address).Balance() - *reply = common.ToHex(v.Bytes()) + *reply = api.xethAtStateNum(args.BlockNumber).BalanceAt(args.Address) + //v := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address).Balance() + //*reply = common.ToHex(v.Bytes()) case "eth_getStorage", "eth_storageAt": args := new(GetStorageArgs) if err := json.Unmarshal(req.Params, &args); err != nil { -- cgit From 3f4c1aaf01032787367a97b6e4574c2784179546 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 2 Apr 2015 12:58:17 +0200 Subject: info => debug --- 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 d9206eb79..4a17d3b15 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -36,7 +36,7 @@ func (api *EthereumApi) xethAtStateNum(num int64) *xeth.XEth { func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error { // Spec at https://github.com/ethereum/wiki/wiki/JSON-RPC - rpclogger.Infof("%s %s", req.Method, req.Params) + rpclogger.Debugf("%s %s", req.Method, req.Params) switch req.Method { case "web3_sha3": -- cgit