Merge branch 'rpcargs' of github.com:tgerring/go-ethereum into rpcargs

pull/579/head
Taylor Gerring 10 years ago
commit 7eed7e1d96
  1. 2
      rpc/api.go
  2. 8
      rpc/args.go
  3. 4
      rpc/args_test.go

@ -212,7 +212,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
args := new(HashIndexArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
}
tx := api.xeth().EthTransactionByHash(args.Hash.Hex())
tx := api.xeth().EthTransactionByHash(args.Hash)
if tx != nil {
*reply = NewTransactionRes(tx)
}

@ -61,7 +61,7 @@ func numString(raw interface{}, number *int64) error {
}
type GetBlockByHashArgs struct {
BlockHash common.Hash
BlockHash string
IncludeTxs bool
}
@ -80,7 +80,7 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("blockHash", "not a string")
}
args.BlockHash = common.HexToHash(argstr)
args.BlockHash = argstr
if len(obj) > 1 {
args.IncludeTxs = obj[1].(bool)
@ -360,7 +360,7 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) {
}
type HashIndexArgs struct {
Hash common.Hash
Hash string
Index int64
}
@ -379,7 +379,7 @@ func (args *HashIndexArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewInvalidTypeError("hash", "not a string")
}
args.Hash = common.HexToHash(arg0)
args.Hash = arg0
if len(obj) > 1 {
arg1, ok := obj[1].(string)

@ -191,7 +191,7 @@ func TestGetBalanceArgsAddressInvalid(t *testing.T) {
func TestGetBlockByHashArgs(t *testing.T) {
input := `["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]`
expected := new(GetBlockByHashArgs)
expected.BlockHash = common.HexToHash("0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331")
expected.BlockHash = "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
expected.IncludeTxs = true
args := new(GetBlockByHashArgs)
@ -1444,7 +1444,7 @@ func TestBlockNumIndexArgsIndexInvalid(t *testing.T) {
func TestHashIndexArgs(t *testing.T) {
input := `["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x1"]`
expected := new(HashIndexArgs)
expected.Hash = common.HexToHash("0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b")
expected.Hash = "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b"
expected.Index = 1
args := new(HashIndexArgs)

Loading…
Cancel
Save