diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-04-02 19:17:55 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-04-02 19:17:55 +0800 |
commit | e402e1dc2e72df2a433b984caeaba771085b2b66 (patch) | |
tree | a9083825ab58d3ff37a1a8137b10d68865d6d565 /rpc/api.go | |
parent | 14c14fd61f72bfa8c1494fa799a4f2e2eb14f4c1 (diff) | |
download | go-tangerine-e402e1dc2e72df2a433b984caeaba771085b2b66.tar.gz go-tangerine-e402e1dc2e72df2a433b984caeaba771085b2b66.tar.zst go-tangerine-e402e1dc2e72df2a433b984caeaba771085b2b66.zip |
New args types with stricter checking
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rpc/api.go b/rpc/api.go index 940b80758..478ca8752 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -108,15 +108,15 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err count := api.xethAtStateNum(args.BlockNumber).TxCountAt(args.Address) *reply = common.ToHex(big.NewInt(int64(count)).Bytes()) case "eth_getBlockTransactionCountByHash": - args := new(GetBlockByHashArgs) + args := new(HashArgs) if err := json.Unmarshal(req.Params, &args); err != nil { return err } - block := NewBlockRes(api.xeth().EthBlockByHash(args.BlockHash), false) + block := NewBlockRes(api.xeth().EthBlockByHash(args.Hash), false) *reply = common.ToHex(big.NewInt(int64(len(block.Transactions))).Bytes()) case "eth_getBlockTransactionCountByNumber": - args := new(GetBlockByNumberArgs) + args := new(BlockNumArg) if err := json.Unmarshal(req.Params, &args); err != nil { return err } @@ -124,16 +124,16 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err block := NewBlockRes(api.xeth().EthBlockByNumber(args.BlockNumber), false) *reply = common.ToHex(big.NewInt(int64(len(block.Transactions))).Bytes()) case "eth_getUncleCountByBlockHash": - args := new(GetBlockByHashArgs) + args := new(HashArgs) if err := json.Unmarshal(req.Params, &args); err != nil { return err } - block := api.xeth().EthBlockByHash(args.BlockHash) + block := api.xeth().EthBlockByHash(args.Hash) br := NewBlockRes(block, false) *reply = common.ToHex(big.NewInt(int64(len(br.Uncles))).Bytes()) case "eth_getUncleCountByBlockNumber": - args := new(GetBlockByNumberArgs) + args := new(BlockNumArg) if err := json.Unmarshal(req.Params, &args); err != nil { return err } |