aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:28:25 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:28:25 +0800
commit216175c265e7c5a82e47df3302f285104593dfa8 (patch)
tree7649544ec7a1228bf938004b2a3a8d656218e5af /rpc
parent7e6c8a411d73f1406ec12d6a75225a2a60fdfa45 (diff)
downloaddexon-216175c265e7c5a82e47df3302f285104593dfa8.tar.gz
dexon-216175c265e7c5a82e47df3302f285104593dfa8.tar.zst
dexon-216175c265e7c5a82e47df3302f285104593dfa8.zip
inline GetBlockUncleCountByNumber
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/rpc/api.go b/rpc/api.go
index fcab90f3b..acec7f457 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -373,12 +373,6 @@ func (p *EthereumApi) GetBlockUncleCountByHash(blockhash string) (int64, error)
return int64(len(br.Uncles)), nil
}
-func (p *EthereumApi) GetBlockUncleCountByNumber(blocknum int64) (int64, error) {
- block := p.xeth().EthBlockByNumber(blocknum)
- br := NewBlockRes(block)
- return int64(len(br.Uncles)), nil
-}
-
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)
@@ -492,11 +486,9 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
- v, err := p.GetBlockUncleCountByNumber(args.BlockNumber)
- if err != nil {
- return err
- }
- *reply = common.ToHex(big.NewInt(v).Bytes())
+ block := p.xeth().EthBlockByNumber(args.BlockNumber)
+ br := NewBlockRes(block)
+ *reply = common.ToHex(big.NewInt(int64(len(br.Uncles))).Bytes())
case "eth_getData", "eth_getCode":
args := new(GetDataArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {