aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:29:46 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:29:46 +0800
commitc57eb286d66c01af0116e12a2476f546727e88ae (patch)
tree3574ab1271bd1ba53afc6592c8457d3e4da9a097 /rpc
parent216175c265e7c5a82e47df3302f285104593dfa8 (diff)
downloadgo-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.tar
go-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.tar.gz
go-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.tar.bz2
go-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.tar.lz
go-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.tar.xz
go-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.tar.zst
go-tangerine-c57eb286d66c01af0116e12a2476f546727e88ae.zip
inline GetBlockUncleCountByHash
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 acec7f457..b17b51317 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -367,12 +367,6 @@ func (p *EthereumApi) GetBlockTransactionCountByNumber(blocknum int64) (int64, e
return int64(len(br.Transactions)), nil
}
-func (p *EthereumApi) GetBlockUncleCountByHash(blockhash string) (int64, error) {
- block := p.xeth().EthBlockByHash(blockhash)
- 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)
@@ -475,11 +469,9 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
- v, err := p.GetBlockUncleCountByHash(args.BlockHash)
- if err != nil {
- return err
- }
- *reply = common.ToHex(big.NewInt(v).Bytes())
+ block := p.xeth().EthBlockByHash(args.BlockHash)
+ br := NewBlockRes(block)
+ *reply = common.ToHex(big.NewInt(int64(len(br.Uncles))).Bytes())
case "eth_getUncleCountByBlockNumber":
args := new(GetBlockByNumberArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {