aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 20:37:56 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 20:37:56 +0800
commit28e5fc83526af17a911eece6befa5fe54578fb55 (patch)
tree0c01a304d692e5c0a7f8a1aff11f0dff47d7f215 /rpc
parentb3329bc698722881b636af882df67eff79822da4 (diff)
downloaddexon-28e5fc83526af17a911eece6befa5fe54578fb55.tar.gz
dexon-28e5fc83526af17a911eece6befa5fe54578fb55.tar.zst
dexon-28e5fc83526af17a911eece6befa5fe54578fb55.zip
Make pretty
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 3b60d661b..5f29886e0 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -111,7 +111,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case "net_listening":
*reply = p.xeth().IsListening()
case "net_peerCount":
- *reply = common.ToHex(big.NewInt(int64(p.xeth().PeerCount())).Bytes())
+ v := p.xeth().PeerCount()
+ *reply = common.ToHex(big.NewInt(int64(v)).Bytes())
case "eth_coinbase":
// TODO handling of empty coinbase due to lack of accounts
res := p.xeth().Coinbase()
@@ -123,11 +124,13 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case "eth_mining":
*reply = p.xeth().IsMining()
case "eth_gasPrice":
- *reply = common.ToHex(p.xeth().DefaultGas().Bytes())
+ v := p.xeth().DefaultGas()
+ *reply = common.ToHex(v.Bytes())
case "eth_accounts":
*reply = p.xeth().Accounts()
case "eth_blockNumber":
- *reply = common.ToHex(p.xeth().Backend().ChainManager().CurrentBlock().Number().Bytes())
+ v := p.xeth().Backend().ChainManager().CurrentBlock().Number()
+ *reply = common.ToHex(v.Bytes())
case "eth_getBalance":
args := new(GetBalanceArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
@@ -138,7 +141,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
- *reply = common.ToHex(p.xeth().AtStateNum(args.BlockNumber).State().SafeGet(args.Address).Balance().Bytes())
+ v := p.xeth().AtStateNum(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 {
@@ -174,18 +178,16 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
- block := p.xeth().EthBlockByHash(args.BlockHash)
- br := NewBlockRes(block)
- *reply = common.ToHex(big.NewInt(int64(len(br.Transactions))).Bytes())
+ block := NewBlockRes(p.xeth().EthBlockByHash(args.BlockHash))
+ *reply = common.ToHex(big.NewInt(int64(len(block.Transactions))).Bytes())
case "eth_getBlockTransactionCountByNumber":
args := new(GetBlockByNumberArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- block := p.xeth().EthBlockByNumber(args.BlockNumber)
- br := NewBlockRes(block)
- *reply = common.ToHex(big.NewInt(int64(len(br.Transactions))).Bytes())
+ block := NewBlockRes(p.xeth().EthBlockByNumber(args.BlockNumber))
+ *reply = common.ToHex(big.NewInt(int64(len(block.Transactions))).Bytes())
case "eth_getUncleCountByBlockHash":
args := new(GetBlockByHashArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
@@ -234,12 +236,12 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
- result, err := p.xeth().AtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
+ v, err := p.xeth().AtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
if err != nil {
return err
}
- *reply = result
+ *reply = v
case "eth_flush":
return NewNotImplementedError(req.Method)
case "eth_getBlockByHash":