From 2f3a9681360f5326137de3aeb0aa8e2130de562a Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Mon, 30 Mar 2015 16:20:30 +0200 Subject: New CallArgs Requirements for calls differ from transactions --- rpc/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index 502079177..bcd073ed2 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -159,7 +159,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err } *reply = v case "eth_call": - args := new(NewTxArgs) + args := new(CallArgs) if err := json.Unmarshal(req.Params, &args); err != nil { return err } -- cgit v1.2.3 From 8f0e095f4c269c48ac2c182c891e6346929de57b Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 31 Mar 2015 17:56:06 +0200 Subject: Index is zero-based #607 --- rpc/api.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index 502079177..bce9a46e7 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -213,7 +213,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err br := NewBlockRes(block) br.fullTx = true - if args.Index > int64(len(br.Transactions)) || args.Index < 0 { + if args.Index >= int64(len(br.Transactions)) || args.Index < 0 { return NewValidationError("Index", "does not exist") } *reply = br.Transactions[args.Index] @@ -227,7 +227,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err v := NewBlockRes(block) v.fullTx = true - if args.Index > int64(len(v.Transactions)) || args.Index < 0 { + if args.Index >= int64(len(v.Transactions)) || args.Index < 0 { return NewValidationError("Index", "does not exist") } *reply = v.Transactions[args.Index] @@ -239,7 +239,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash)) - if args.Index > int64(len(br.Uncles)) || args.Index < 0 { + if args.Index >= int64(len(br.Uncles)) || args.Index < 0 { return NewValidationError("Index", "does not exist") } @@ -257,7 +257,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err v := NewBlockRes(block) v.fullTx = true - if args.Index > int64(len(v.Uncles)) || args.Index < 0 { + if args.Index >= int64(len(v.Uncles)) || args.Index < 0 { return NewValidationError("Index", "does not exist") } -- cgit v1.2.3 From 7e3875b52720bf7456c9dd6162caeb7250d3686e Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 31 Mar 2015 19:04:02 +0200 Subject: Remove custom MarshalJSON methods Now formats based on underlying hexdata or hexnum type. Fields directly with respective constructors that cover from native types --- rpc/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index bce9a46e7..3f5d33da6 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -244,7 +244,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err } uhash := br.Uncles[args.Index] - uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash.Hex())) + uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash.String())) *reply = uncle case "eth_getUncleByBlockNumberAndIndex": @@ -262,7 +262,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err } uhash := v.Uncles[args.Index] - uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash.Hex())) + uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash.String())) *reply = uncle case "eth_getCompilers": -- cgit v1.2.3 From 40ea46620066bd7888b3f9a425fcd6201e0c7320 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 31 Mar 2015 22:40:12 +0200 Subject: Store and retrieve tx context metadata #608 Improving this in the future will allow for cleaning up a bit of legacy code. --- rpc/api.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index 3f5d33da6..48039511e 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -199,9 +199,13 @@ 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) + tx, bhash, bnum, txi := api.xeth().EthTransactionByHash(args.Hash) if tx != nil { - *reply = NewTransactionRes(tx) + v := NewTransactionRes(tx) + v.BlockHash = newHexData(bhash) + v.BlockNumber = newHexNum(bnum) + v.TxIndex = newHexNum(txi) + *reply = v } case "eth_getTransactionByBlockHashAndIndex": args := new(HashIndexArgs) -- cgit v1.2.3 From 02fb83782eab5d6ad394aca58daab77a9525d5ff Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 1 Apr 2015 12:28:48 +0200 Subject: #612 rename eth_protocol method --- rpc/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rpc/api.go') diff --git a/rpc/api.go b/rpc/api.go index 7f10f16e3..c046c22fe 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -54,7 +54,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err case "net_peerCount": v := api.xeth().PeerCount() *reply = common.ToHex(big.NewInt(int64(v)).Bytes()) - case "eth_version": + case "eth_protocolVersion": *reply = api.xeth().EthVersion() case "eth_coinbase": // TODO handling of empty coinbase due to lack of accounts -- cgit v1.2.3