aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:31:40 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-20 08:31:40 +0800
commit0895190b64204205ed9cbc52a65b1060db4e43b4 (patch)
tree2e13654155bf52b57c354077ae6dbd2d05669e46 /rpc/api.go
parentff657edbb6222db826175965f9ec5b26dbf4385e (diff)
downloaddexon-0895190b64204205ed9cbc52a65b1060db4e43b4.tar.gz
dexon-0895190b64204205ed9cbc52a65b1060db4e43b4.tar.zst
dexon-0895190b64204205ed9cbc52a65b1060db4e43b4.zip
inline GetBlockTransactionCountByHash
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/rpc/api.go b/rpc/api.go
index b9e2ca09d..ded8b0296 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -355,12 +355,6 @@ func (p *EthereumApi) GetBlockByNumber(blocknum int64, includetx bool) (*BlockRe
return br, nil
}
-func (p *EthereumApi) GetBlockTransactionCountByHash(blockhash string) (int64, error) {
- block := p.xeth().EthBlockByHash(blockhash)
- br := NewBlockRes(block)
- return int64(len(br.Transactions)), 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)
@@ -441,11 +435,9 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return err
}
- v, err := p.GetBlockTransactionCountByHash(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.Transactions))).Bytes())
case "eth_getBlockTransactionCountByNumber":
args := new(GetBlockByNumberArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {