diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-20 08:30:42 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-20 08:30:42 +0800 |
commit | ff657edbb6222db826175965f9ec5b26dbf4385e (patch) | |
tree | f213f0987b45b5e4e9ef7c8371d032c33b4163dd | |
parent | c57eb286d66c01af0116e12a2476f546727e88ae (diff) | |
download | go-tangerine-ff657edbb6222db826175965f9ec5b26dbf4385e.tar.gz go-tangerine-ff657edbb6222db826175965f9ec5b26dbf4385e.tar.zst go-tangerine-ff657edbb6222db826175965f9ec5b26dbf4385e.zip |
inline GetBlockTransactionCountByNumber
-rw-r--r-- | rpc/api.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/rpc/api.go b/rpc/api.go index b17b51317..b9e2ca09d 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -361,12 +361,6 @@ func (p *EthereumApi) GetBlockTransactionCountByHash(blockhash string) (int64, e return int64(len(br.Transactions)), nil } -func (p *EthereumApi) GetBlockTransactionCountByNumber(blocknum int64) (int64, error) { - block := p.xeth().EthBlockByNumber(blocknum) - 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) @@ -458,11 +452,9 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return err } - v, err := p.GetBlockTransactionCountByNumber(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.Transactions))).Bytes()) case "eth_getUncleCountByBlockHash": args := new(GetBlockByHashArgs) if err := json.Unmarshal(req.Params, &args); err != nil { |