diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-26 17:14:52 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-26 17:14:52 +0800 |
commit | c7dc379da5a02fb8ac92788fa317379fbde00d20 (patch) | |
tree | d24ca050c0292cc8923af84da0ac236f4989fddb /rpc | |
parent | 7e1e264375fe4bebbf6bb40604d0060744ebae2a (diff) | |
download | go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.tar go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.tar.gz go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.tar.bz2 go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.tar.lz go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.tar.xz go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.tar.zst go-tangerine-c7dc379da5a02fb8ac92788fa317379fbde00d20.zip |
GetBlockByHashArgs
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api.go | 8 | ||||
-rw-r--r-- | rpc/args.go | 4 | ||||
-rw-r--r-- | rpc/args_test.go | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/rpc/api.go b/rpc/api.go index aa5b54199..8d1a412d1 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -245,7 +245,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - block := api.xeth().EthBlockByHash(args.Hash) + block := api.xeth().EthBlockByHexstring(args.Hash) br := NewBlockRes(block) br.fullTx = true @@ -273,14 +273,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash)) + br := NewBlockRes(api.xeth().EthBlockByHexstring(args.Hash)) if args.Index > int64(len(br.Uncles)) || args.Index < 0 { return NewValidationError("Index", "does not exist") } uhash := br.Uncles[args.Index].Hex() - uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash)) + uncle := NewBlockRes(api.xeth().EthBlockByHexstring(uhash)) *reply = uncle case "eth_getUncleByBlockNumberAndIndex": @@ -298,7 +298,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err } uhash := v.Uncles[args.Index].Hex() - uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash)) + uncle := NewBlockRes(api.xeth().EthBlockByHexstring(uhash)) *reply = uncle case "eth_getCompilers": diff --git a/rpc/args.go b/rpc/args.go index 5b655024c..9a51959f4 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -35,7 +35,7 @@ func blockHeight(raw interface{}, number *int64) (err error) { } type GetBlockByHashArgs struct { - BlockHash string + BlockHash common.Hash IncludeTxs bool } @@ -54,7 +54,7 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) { if !ok { return NewDecodeParamError("BlockHash not a string") } - args.BlockHash = argstr + args.BlockHash = common.HexToHash(argstr) if len(obj) > 1 { args.IncludeTxs = obj[1].(bool) diff --git a/rpc/args_test.go b/rpc/args_test.go index 5cbafd4b2..c6d3a558b 100644 --- a/rpc/args_test.go +++ b/rpc/args_test.go @@ -83,7 +83,7 @@ func TestGetBalanceEmptyArgs(t *testing.T) { func TestGetBlockByHashArgs(t *testing.T) { input := `["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]` expected := new(GetBlockByHashArgs) - expected.BlockHash = "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" + expected.BlockHash = common.HexToHash("0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331") expected.IncludeTxs = true args := new(GetBlockByHashArgs) |